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

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: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.

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