/dpt/ — Daily Programming Thread

Elegant Objects edition.

What objects are you decorating and composing, Jow Forums?

Previous thread:

Attached: cactus.png (4549x5000, 2M)

Other urls found in this thread:

strawpoll.me/16475420
github.com/RFEtree/sauce
go.googlesource.com/proposal/ /master/design/go2draft-contracts.md
lkml.org/lkml/2018/9/16/167
twitter.com/SFWRedditImages

closures > objects

Enlighten me

Should I get an MS, PhD, or stay with BS in CS?
Chart assumes no salary increases with career experience, 5 years to get PhD, and 2 years to get MS
strawpoll.me/16475420

Attached: 5yPhd.png (640x480, 42K)

github.com/RFEtree/sauce
c++ saucenao library with *booru integration. wrote this at the request of an user here at /dpt/ a week ago. you can use it on a file to get sauce of a file and access booru data about it

I'm looking for collaborators, contributors, whatever. if I don't get any I'm gonna abandon this. r8 and h8

Wait-free concurrent objects!

Attached: new_game__artwork__1___aoba_suzukaze_by_redtiger1246-dahmbou[1].png (663x801, 174K)

also if anyone else wants a hand for their oepn soucre project (you) me

languages: c, c++, c#, java, js, python, perl, php, ruby, sh

>Not using closures to implement proper objects

(define (interface-foo getX setX)
(lambda args
(match args
[`(getX) (getX)]
[`(setX ,nx) (setX nx)]
[_ (error "wrong message: " args)])))


(define (object-foo)
;; attributes
(define x 0)

;; methods
(define (getX) x)
(define (setX nX) (set! x nX))

;; interface
(interface-foo getX setX))

(define foo (object-foo))
(foo 'setX 123)
(displayln (foo 'getX))

Attached: sicpCold.png (1700x1700, 2.45M)

Imagine the fucking overhead

that's a lot of code for just defining class with getter and setter for one variable

>class
there is no class here, you can do oo without them (closure, prototype, ...)

you could make that very fast using macros with arrays or structure types.

I am an inflatable anthro wolf balloonie and pictures of cactus scare me.

Anyway, I'm writing fucking bullshit rslogix 5000 ladder logic for work.

Not at all, it's about the same really.

Is there a better way to do this than matching symbols manually?

class Penis {
int x { get; set; }
}

ok buddy

Don't go back and pursue one unless you want to be unbelievably stressed out

you could implement a virtual table mechanism.

is this true?

Attached: google-vs-raytheon.jpg (2518x1024, 283K)

i have implemented a oo model in, what ? 6 lines? what is the implementation behind your model?

It's closer to this, which is a comparable amount of code.
interface IFoo
{
int getX();
void setX(int x);
}

class Foo
{
int x;
int getX() { return x; }
void setX(int x) { this.x = x; }
}

You do have your C# properties syntax sugar, but you could equally implement that with a macro which is a superior solution because that isn't a magic builtin construct that only works in a couple circumstances and can't be applied elsewhere.
But then again, that's what this whole exercise is about - how simply and elegantly you can implement many common constructs that are typically baked into lesser languages with nothing more than a closure.

>raytheon
that's such a cool fucking name
you could remove all of the annotations and just have the names desu

Hideous.

really? why?

>Wait-free
Lock-free is the correct terminology, i think.

Wait-free ⇒ lock-free

Is finding and selling zero-days in software for a living possible if you do it on your own? Is it possible to get rich this way?

Attached: autogynephilia.jpg (640x544, 69K)

pls respond

we already had this discussion

>tfw Linux has a CoC
Why don't you?

I blame the mentally ill rustfags for ruining linux.

>In particular, we enable locks to use Hardware Transactional Memory (HTM) in order to prevent threads from holding locks while not scheduled, which is a rather novel use-case for HTM.

Attached: 240a648ba031c50e4ff52837c49b5a99469e8c69_hq[1].jpg (999x1024, 57K)

>match

Is that Racket, Chicken, or Guile? Because whatever the case, you might as well just use their version of CLOS (Racket has its own version, Chicken uses Tiny-CLOS, and Guile uses GOOPS).

it's racket but the point was to show the link between closures and objects.

It's just a demonstration that you can trivially implement objects with closures, dude.

>It's just a demonstration that you can implement trivial objects with closures
FTFY

i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8

Welcome to GNU CLISP 2.49 (2010-07-07)

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010

Attached: 1491736843674.jpg (960x675, 91K)

It's less virgin vs chad and more Dilbert vs dystopian hellscape with ball pits.

it's bash related
i just want the temp to be shown so that i can add it in panel. thanks. how to remove CPU : and all that stuff
$sensors | grep CPU
CPU: +86.0°C >inb4 use /etc/blah blah
it's giving me incorrect temp and this is accurate
can anyone help me out.

You can implement arbitrarily complex objects using closures.

Pic related is a better Python.
Search your feelings, you know it to be true.

Attached: ihatecocs.png (2000x2000, 442K)

That wasn't demonstrated.

That isn't a high bar to reach

I'd say that a PhD is worth it if you do it outside the US.

sure, user. sure.

Attached: ZenOfRuby.png (1000x500, 643K)

What would you like to see demonstrated, then?

>code written in Go or JS or some shit, no performance requirements, anything goes
>code written in C or similar, very high performance requirements and testing
Mine shows this:
temp1: +39.0°C

Anyhow, try this:
sensors | grep CPU | grep '[+-][^C]*C'

...

you implement a lock-free linked list by swapping pointers using an atomic cpu instruction.

>sensors | grep CPU | grep '[+-][^C]*C'
nope still showing the same one. i've been trying with cut too. not working well

fuck, should be
sensors | grep CPU | grep '[+-][^C]*C' --only-matching

thanks einstein

>sensors | grep CPU | grep '[+-][^C]*C' --only-matching
got it. working fine man. thanks for the quick response
here's a pic for you

Attached: 1035.jpg (1931x1288, 514K)

return 1-x/2
After getting the wrong result a thousand times I realized it has to be
return 1-(x/2)
It boggles my mind that even diaper languages like Java (that don't even trust you with handling pointers) don't consider order of operations.

OOPsies BTFO all thread, every thread. Your alleged paradigm (which doesn't actually exist, it's just imperative programming in disguise and worse) is garbage, and the mainstream languages for it were designed for novice programmers, and ruined their potential expressivity in order to be "beginner-friendly".

Reminder that C is OOP

>he thinks I'm a C user, of all things
BAHAHAHAHAHAHAHAHA

Not using C makes you a fook

How perfectly idiotic. Now go back to playing with your toy language so the adults can resume talking.

c doesn't have objects as an data abstraction technique

It has structs, and you can define functions that take structs as arguments

>go is bragmadic :D :D
I'd rather use JS than Go tbqh, it's slightly less awful

why?

does go even have closures?

JavaScript rocks!

this

JavaScript is functional!

i'm on my third day of trying to find a list of interrupt IDs for the ARM integrator/cp

Incredible, a consecutive trio of incorrect posts. Please go back to

Go is better Python.

yes

oh cool

shame it doesn't have polymorphic functions then

It's dynamically typed ergo garbage.

is that what you fags are moving on to whining about now that generics and "try!" functionality are confirmed for go2?

>Go better than anything
seriously hope

Why are you so triggered by go? Every fucking thread.

Scriptslangs are bottom of the barrel. Not hard to be better than absolute garbage.

does it have generic function types? I'm not sure if it has templates like C++ or real parametric polymorphism

also I looked at the error handling proposals and they were worse than what's already there

Proof that type theory is a mental illness.

Attached: 1537204330330.png (1172x965, 680K)

>Every fucking thread
haven't replied to a Go post in months, what you talking about?

how to make pretty modern gui in c#?
winforms looks ugly

Attached: if_else.jpg (594x768, 73K)

>this one person who has vaguely learned a tiny bit of type theory is mentally ill
>type theory itself is mental illness

All type autists exhibit tendencies toward mental illness because it takes a literal crazy person to get so hung up on something so masturbatory

> theres only one person who disagrees with me and they are a maniac

Keep wishing

t. still upset about failing his haskell class

go.googlesource.com/proposal/ /master/design/go2draft-contracts.md

>also I looked at the error handling proposals and they were worse than what's already there
diagnosis: terminal whining

you have a grudge.

"You", plural, a group, as in "you people".

You arent into types? Well whatever it is you are doing, you just keep doing it lol.

>lkml.org/lkml/2018/9/16/167
> tfw Linus came around to the American ideology of niceness
My little Linus can't be this polite

"you" isnt plural

This person hasn't demonstrated any interest or capability in type theory besides implementing babby's first functional language with System F types and pattern matching (Plutus).

Why use dozens of types when you could write thousands of tests and still not have fun coverage?

Why does Jow Forums hate python? Most people love it.

>you people
as in /dpt/? would make sense if a number of us don't like Go considering it's Go. Even google is abandoning it for some BASIC-like

Is it common for programs on Windows to make changes to the registry?

Attached: 1418848675771.jpg (161x162, 7K)

Elitism. It's a great language for multiple purposes, but it's too accessible, and doesn't completely fit some anally strict autism rules, so of course it doesn't appeal here

thou

ye

I fucking hate my job. Management is a total chaos. The work is mind numbing. The team has low morale.
>enter meeting to discuss upcoming features
>management is fighting each other
>none of the features can be started because of dependencies
>...daydream...
>leave meeting

Aside from the Uninstall data? Depends whether they intend to start with windows, associate file types, add context menu entries etc.

There is no reason for Python to exist. Lisp had already existed for decades and was considerably better.