Live data from Hacker News

Strangest Programming Language Feature?

stackoverflow.com

1–10 of 66 posts

Re: Strangest Programming Language Feature?

#4
It logically follows from how arrays in C works, so I don't really know if it qualifies for weird/suprising, but the old array[i] / i[array] thing is fun to show to people who haven't seen it before.

The most amusingly weird thing I can think of is INTERCAL's COMEFROM: http://en.wikipedia.org/wiki/COMEFROM

Re: Strangest Programming Language Feature?

#5
No mention of "ALTER" (http://en.wikipedia.org/wiki/COBOL#Self-modifying_code) on the first page?

Self-modifying code was fairly common at the time COBOL was developed, but incorporating it in a high-level business language was, IMO, a very weird decision.

I also miss call by name (http://en.wikipedia.org/wiki/Man_or_boy_test) on the first page.

In general, one should read the Intercal (http://en.wikipedia.org/wiki/INTERCAL) paper, and figure out from which language each of its features came.

Re: Strangest Programming Language Feature?

#8
post #6

/me drops the MUMPS reference manual on the table That whole language is one long-running WTF.

This line in MUMPS is not only valid, it also actually does something potentially useful:

    s:foo'="" foo(foo)=foo
It's actually a bit tricky to explain what it does. Everything in MUMPS is effectively a tree. Each tree has a value in the "root node" and you can set it like this:

    set foo="hello"
You can also put data deeper into the tree:

    set foo("fizz")="buzz"
So if something is passed to you and you want to know if you can treat it as a string, you test to see if it's a null string:

    if foo'="" do [something]
('= means !=)

Two more features: 1) Almost every directive can be reduced to one letter. 2) If I want to quit based on a condition, I can do either if condition quit or quit:condition

So the line above is more legibly written as

    if foo'=""  set foo(foo)=foo
So if foo="bar", it's equivalent to:

    set foo("bar")="bar"
Post reply on HN