Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C/C++

Name: Anonymous 2011-09-10 23:04

What does the following C/C++ construction do?


compM<ListM>()[ makePair[X,Y] | X<=list_with(1,2), guard[true],
          Y<=list_with(3,4), guard[ (Y %divides% X) %equal% 3 ] ] ]

Name: Anonymous 2011-09-10 23:05

>>1
This is a Haskell or Java contruction, not C++.

Name: Anonymous 2011-09-10 23:08

>>2
It's actually valid C++.

Name: Anonymous 2011-09-10 23:13

Hope after about 10 years of practice I'll be able to freely read such code.

Name: Anonymous 2011-09-10 23:21

>>4
You know what they say: C++ practice does make one perfect insane.

Name: Anonymous 2011-09-10 23:25

>>1
It's impossible to figure out by just looking at that code fragment because it's obvious that whoever wrote it decide it was a smart idea to overload the array index operator [], operator % and who knows what else for a bunch of different types. You would need to look at all of the code, or any existing documentation accompanying the code, to figure out the true semantics.

This isn't a fault of the C++ language. It's the fault of the stupid programmer who decided to overload a bunch of operators and give them non-obvious semantics.

It would be same as building an equivalent DSL in say Lisp with cryptic function names with non-obvious semantics. Glancing at:

(compM `ListM (or (makePair X Y) ((<= X (list_with 1 2)) (guard true) (<= Y (list_with 3 4) (guard (% (% Y `divides X) `equal 3))))))

doesn't make anymore sense either.

>>4
No, you were trolled, you wouldn't be able to figure it out by just looking at the above fragment. But don't mistake it for the complexity of the language, that's not the problem.

Name: Anonymous 2011-09-10 23:37

>>6
))))))
Sorry, had to.

Name: tdavis 2011-09-11 0:05

>>6

Lots of stuff in C++ is distracting gimmacks that are an excuse for not working.

Do you really need to alphabetize soup cans in the cupboard?

Name: Anonymous 2011-09-11 0:43

>>8
Only an autist/obsessive-compulsive/neurotic becomes distracted by the gimmicks in C++, just like only the autist/obsessive-compulsive/neurotic becomes preoccupied with alphabetically sorting the soup cans in his cupboard.

Name: Anonymous 2011-09-11 2:47

>>9
Only an autist/obsessive-compulsive/neurotic becomes distracted by the gimmicks in C++,

and everyone else basically writes C.

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2011-09-11 4:27

>>3
It has an extra right bracket.

Name: Anonymous 2011-09-11 9:52

Yesterday I used C++ because I didn't feel like reimplementing yet another stack data structure. Afterwards I took a shower with lots of scrubbing.

Don't change these.
Name: Email:
Entire Thread Thread List