/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

pastebin.com/y48Pa8py)
magicpackets.net:3000/proudfeet/netrunner
github.com/tomhrr/dale
github.com/carp-lang/Carp
twitter.com/AnonBabble

Haskell!

C++ belongs to garbage bins

Is having a sub-60 IQ a requirement for participating in these threads?

Thank you! Simon Peytones sends love!

**+ is strictly forbidden ITT. You can post those nonsense in /trash/

what am I allowed to post?

>H*skall
Please do not mention H*skall ITT. Spamming is not encouraged

>**+
Please do not mention **+ ITT. Spamming is not encouraged

Reposting before the shitposters come out again.

I am learning the basics of OOP in Python and I am wondering what's going wrong. This minimal program works as intended: Each of the Beatle objects is destroyed when the main() function ends:

#!/usr/bin/python
class Dude:
def __init__(self, name):
self.name = name
def getName(self):
return self.name

class Beatle(Dude):
def __init__(self, name, instr):
self.name = name
self.instr = instr
def __del__(self):
print "%s is ded." % self.name

def main():
Dude1 = Dude("Hans")
Dude2 = Dude("Franz")
Beatles = []
for (name, instr) in zip( ("John", "Paul", "George", "Ringo"), \
("Keys", "Bass", "Guitar", "Drums")):
Beatles.append(Beatle(name, instr))
return 0

if __name__ == "__main__":
main()

However, in this longer program (pastebin.com/y48Pa8py) I wrote prior to this stripped-down version, this is not the case. It seems that none of the Guy objects in the Guys list report their death, while a single Guy object does. What's going on?

So I guess we can only talk about Java, C#, Python, VHDL Fortran, Pascal and Rust in here?

seriously?.lisp
(defvar duck '(1 2 3 4 5))
(defvar frog (cddr duck))

(print duck)
(print frog)

(setf (cddr duck) '(8 9 10))

(print duck)
(print frog)

output
(1 2 3 4 5)
(3 4 5)
(1 2 8 9 10)
(3 4 5)

When did you realize Lisp was shit?

Anything but that garbage

>OOP
>Python
We don't like your kind around here.

Yes. That """language"""(!) is not allowed here

Too productive for you, right?

>Java, C#, Python, VHDL Fortran, Pascal and Rust
Please do not mention Java, C#, Python, VHDL Fortran, Pascal and Rust ITT. Spamming is not encouraged

>sp*mming
pl*ase d* n*t men*ion sp***ing i*t

>languages are """"""productive""""""
This is your tiny little brain on Python

I am working on ISO 7816 Smart Card library for Rust.

you're doing oop in python

R*st and p*thon are strictly forbidden ITT.

So how are you liking your first week away from Sup Forums so far?
Seriously, why is Python getting so much hate here? It's easy to read, easy to learn, useful for everyday shit. As for OOP, it certainly is annoying for small programs, but gets really useful for certain applications. One of the projects I am working on would benefit a lot from an object oriented approach, so I'm trying to brush up on it.
In school I learned OOP basics in Java and C++, I haven't tried it in Python yet.

I found some peculiarity, I asked here because I'm trying to learn instead of getting my answers spoonfed to me, so why are you being so hostile?

I don't even hate python, I just hate oop in Python.

Anything is tolerable than **+

@60942195
>why is Python getting so much hate here?
Because it's a shit language. Not everyone here is a drooling retard (though most "people" are).

I am starting to see why. Still I'd like to understand exactly what's going on.

We are making a web browser magicpackets.net:3000/proudfeet/netrunner

To join the team contact [email protected]

And people say that H**k**l is unreadable.

def main():
while True:
print "Blow it out your ass, anime poster."

You seem to be new here. All the *chan websites are born out of anime culture.
We apologize that seems to intrinsically trigger your plebbit sensibilities.

*th*n isn't even that good
>indent based syntax

Forgot
if __name__ == "__main__":
main()

Just import it.

Is there a single non-retard who willingly uses python?

Steve Jobs.

You should indent your code anyway, might as well make them meaningful beyond just eye candy. I think you're just upset you can't claim to be superior to someone else for knowing it because it's easy to learn and allows people to get shit done instead of adding \ns to their printfs and semicolons to their lines all day.

>gmail.com
Why would I want to help a government agent?

in haskell that's just

data Either a b = Left a | Right b

either f _ (Left a) = f x
either _ g (Right b) = g b

id x = x

main = exitWith (either id round (Left 0))

exit' 0 = ExitSuccess
exit' n = ExitFailure n


+- some imports

Didn't he create it? Or was it some other guy?

He said non-retard.

It's just ugly.
>__init__
>__del__
>self.foo
>No way to determine what instance variables there are except investigating every member function
Basically if you're using a scripting language for a program of sufficient complexity that you need to use anything more complex than block scoping, you're doing it wrong.

Still, at least it's not as bad as PHP.

It's good for quick FS operations and webpage parsing, among others.

see

>OOP
Does its users not see how poorly coupled their code is?

>Comparing with **+
That's pretty low of you, user

Ritchie, the creator of PHP was a huge collaborator in it.
Just googled it, no it wasn't Steve, it was some guy who hates the reduce function.

OOP is strictly forbidden ITT. Spamming isn't encouraged.

I do. But that's because of a nice library a find. It's more that I use the library and python sadly comes with it.

C++ is the height of programming languages, afterall.
So of course you'd compare your language with C++.
Even Rust markets itself as a C++ replacement.

Why is *** forbidden?

Prove your non-retardation.

That is not what I am asking. I am stuck with Python, I am stuck with an object oriented approach, I want to make it work. Now, can you tell me why the objects from the list in the small program report their "deaths" and the ones from the large program don't, or are you just going to autistically list your minor gripes with a perfectly fine programming language again?

There's nothing wr*ng with comp**ing haskell to (3*)

does make sense. are you retarded?

Yes it seems to be the minimum hurdle(!) to pass

Do you mean POO or C++?

Trying to create a program which given a programming language outputs the complete opposite of that language.
I will use this to create the best language.

What's the difference?

Those are the same thing, idiot

...

Are you going to feed it Haskell?

A pair is made of two values: car and cdr

When doing cddr duck, you retrieve the value of (cdr (cdr duck))
You set that value to frog.
You then change the cdr value of (cdr duck)
But frog still hold the previous value.

Nothing is wrong here.

Everyone who's above their sophomore year CS course that's realized that writing everything in a lower level language is completely unnecessary when it's a better idea to prototype in the easy language and build in the lower level language later. Also data scientists.

If you're doing OOP in C++, you're using C++ incorrectly.

depends on what you mean by OOP

I'm going to feed it some POOlang. I'm thinking J*va or C* right now.

If you are programming C++ thinking like a c programmer, you are doing it wrong.

If you are using C++, you are doing the incorrect thing

so what language isn't forbidden in these threads?

>If you're doing OOP in any language, you're using that language incorrectly.
ftfy

C++ is supposed to be used procedurally.
Procedural code can still make use of objects, it's just syntactic sugar for accepting a self parameter, afterall, which is a common practice in C.

Crystal

Anything but C*+

This is good, Thanks for Insight.

ITT: A bunch of first year comp sci students who have only ever used one language so they get really insecure when people criticize "their" language and start attacking others.

VHDL, Pascal, Ada, FORTRAN, java and C#.

No, you're an idiot.
Using C++ procedurally does not mean C with classes.
C with classes is an even more incorrect way to use C++.

C+-

Lisp since Lisp is for real programmers.

>C*
C#?

Can't be bothered. I scored 131 IQ through SAT to IQ conversion. Which I know isn't the best of measures but still. Not actually retarded.

Would you use this?

Will it it work for smaller parts of languages? Like individual features.

>Thinking language choice matters
>Not designing a well built program that accomplishes the task quickly so you can do more important shit
It's going to be fun when you graduate from NEEThood and realize deadlines are more important than chimping out about language wars.
To stay on topic: making some scripts so I can easily compare commits over git forks. People really need to mark what their working on in the issues section otherwise it becomes difficult to not redo someone else's work.

>well built program
Simply impossible in a lot of languages.

Thanks for the update Vishnu, now please go back to your cubicle and POOlang

Is this a tool that converts code to C or are you presenting the syntax for the upper language and explaining it using a language everyone knows, C?
If the latter I'm not sure I'd ever use something like the above. To me it seems way more inconvenient than the C version. And that's not because I like C.

I am still correct though. I am not a fan of C++ but what I said still holds. Programming c++ while having a C mindset gives you the worst of both worlds.
I even dare to state that teaching people C as an intro to C++ makes them a worse programmer than when you learn them to program C++ without C first.

>well built program that accomplishes the task quickly
Only possible in a language based on either C or Lisp.

I am learning C by reading the book "C programming: A Modern Approach" by K.N. King. It has a lot of interesting stuff and I have already learned a lot. Sincere thanks for recommending it!

Are you supposed to do *all* of the exercises after each chapter or just the ones you find interesting?

Lisp is superior than C in terms of syntax.

Even if it won't you could do multiple passes to get a result closer to what you want.
The only problem is that using the last output as the new input might not be the same as the last input.

What is the first set of utilities you implement in any language if it's missing?
For me it's a deference system. Usually it's just a function pointer/reference for the work to be done, a pointer/reference to data to operate on and a function pointer/reference to a condition function that determines if its time to execute.
Then I throw a function in that just iterates a list of these and calls the function that does stuff when necessary.
It's very nice.

github.com/tomhrr/dale

github.com/carp-lang/Carp

Seems good user. Keep it up.

>(use io)
>Would you use this?
No.

Why is it inconvenient?
It has better constructs and nice features like storing the length of the array using a "fat" pointer using #.

Frob

He's asking if you would use use io, not if you would use io

And there's no way this program is guaranteed to terminate.