Note that instead of adding virtual methods to the ExprAST class hierarchy, it could also make sense to use a visitor pattern or some other way to model this. Again, this tutorial won’t dwell on good software engineering practices: for our purposes, adding a virtual method is simplest. visitor pattern good practices bloated shit that exists only to mitigate the utter uselessness and weakness of COP good practices
Bring me that fucker so I can smash his balls and shove his bloody semen down his dipshit lying throat
Name:
Anonymous2014-12-12 21:17
The visitor pattern requires a programming language that supports single dispatch and method overloading. Under these conditions, consider two objects, each of some class type; one is called the "element", and the other is called the "visitor". An element has an accept() method that can take the visitor as an argument.
Wait a minute, Mr. Sepples, you just said that I won't have to modify the existing classes. Turns out I must add the accept() method to all of them? So I must bloat all my classes with an additional method just for the possibility that somewhere downstream someone might want to add a visitor for them?
Fucking sepples numbskulls die just die and take your shit language with you
Name:
Anonymous2014-12-12 21:22
And I also have to add a separate accept() method for every operation I want to implement? acceptFold(), acceptTraverse(), etc? And sepples idiots call that a "good software engineering practice" and say that it "lets you define a new operation without changing the classes of the elements on which it operates"? Dear YHVH, just kill them all please, and erase all traces of C++ from human history. Please.
"Come on Peter," Sally said, "ditch class and play with me."
Nearby, coffee beans erupted from out James Gosling's anus.
I tell you, when a homosexual is sucking your cock, a lot of strange thoughts go through your head: How the hell did this happen? Where did this fairy ever get the idea that I was gay? And where did he get those fantastic boots?
Name:
Anonymous2014-12-12 21:48
>>4 Java is only simplified Sepples. They took away pointers, multiple inheritance, watered down the templates, and voila. A simplified Sepples for slaves to spew in cubicles for corporate pennies.
>>6 Yes, I did go a little over the top there. The visitor pattern does not require one to add a method for every visitor operation, only to add new classes like Fold, Traverse etc, each with the visit() method.
It is still bloat and boilerplate, though. COP is shit, C++ must die and be rejected like a blight upon humanity.
>>7 The usual C++ way is to write an iterator for your class. Then you can fold and traverse the iterator with a for loop.
Name:
Anonymous2014-12-13 19:25
>>9 But that's still a modification of the class itself. The visitor pattern is supposed to add functionality without class modification. Except that it can't.
Name:
Anonymous2014-12-13 19:38
>>10 You write one iterator associated with your class. Now the same iterator can be used for traversal, folding, etc. Visitor pattern is more restrictive than an iterator in terms of flow control. To implement the visitor pattern, you still need to ``modify the class'' to add a method that will call the visitor on the elements of the data structure.
But these generic traversals aren't appropriate for the example in >>1. A syntax tree isn't a generic set of objects. It has structure and the traversal needs to be aware of this structure.
debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR in thread #<THREAD "main thread" RUNNING {AB1F741}>: Required argument is not a symbol: (OBJ1 CLASS1)
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level.
>>19 By that measure any language that provides some way of dealing with pointers to code supports multiple dispatch.
Name:
Anonymous2014-12-14 22:47
>>23 Pointers and real macros are enough to implement multiple dispatch at the language level.
Name:
Anonymous2014-12-15 0:52
>>24 By definition any feature that must be implemented using another primitive isn't part of the language. The real question is whether multiple dispatch needs to be part of a general purpose language. Given how rarely people in languages that lack it bother to implement it I'm leaning toward the negative position.
Name:
Anonymous2014-12-15 1:16
>>25 Visitor pattern wouldn't be a ``pattern'' if it could just be done with a language feature, like multiple dispatch. Patterns are evidences of lack of language features. These features can be added by extending the language. The more malleable a language, the more patterns it can come to accommidate.
Name:
Anonymous2014-12-15 1:42
The fuck is a pattern?
Name:
Anonymous2014-12-15 1:52
>>27 Something only ENTERPRISE programmers use. Real programmers don't play by their rules and write code freestyle. This results in much greater efficiency and maintainability in non-ENTERPRISE code.
>>27 Do you remember the idiots from your maths classes who solved everything by trying a few predefined solution schemes? Well now some of them are programmers and this is basically the equivalent.
why do they call u cunts weeaboos? why not woonies? I think woonies are weeaaboos who live specifically in the US, so you don't get those japanees 'hunkydorey' cunts, yeah fuck off cudder you fucking woony