Live data from Hacker News

Strangest Programming Language Feature?

stackoverflow.com

41–50 of 66 posts

Re: Strangest Programming Language Feature?

#42
post #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/w…

You mention COBOL, I was aught COBOL the JSP (Jackson) method and did lovely code. My first job they used GOTO and I was like argh, COBOL has a GOTO verb. Performance and the like, much less cleaner code but effecient :\ and with that the first steps from the academic world into the real world open your eyes up to many weird programing ways and features.

But I did always liked the COBOL, OCCURS DEPENDING ON ( http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/inde... ) and how you could use it to write variable length records to files, saving space on tape or DISC and with that faster and cheaper.

it is after all effeciency and getting that extra drop of performance that drives the weird and wonderful quirks and usage and practices that this topic aspires to highlight.

Re: Strangest Programming Language Feature?

#43
INRAC, the langauge RACTER (http://en.wikipedia.org/wiki/Racter) has the most bizarre flow control I've ever seen in any computer language, ever. It can best be described as "a random, pattern matched GOTO/GOSUB" which is the most succinct description I can come up with.

I have a blog entry about it (http://boston.conman.org/2008/06/18.2) but in short, each line of an INRAC program (unless it ends with a '#' mark in which case execution continues to the next line) is a subroutine, each with a label. The label does not need be unique, but when you "call" a subroutine, INRAC will just pick one line with that label at random to execute. The pattern matching comes in because you can select the label with wildcard characters (which just picks a line that matches the pattern at random).

There isn't much about the language on the Internet. In fact, the only other page aside from my blog entry (which I wrote as I went through the existing source code I found for Racter) is the Racter FAQ (https://groups.google.com/forum/#!topic/rec.arts.int-fiction...) which has a few inaccuracies (or perhaps was looking at a version of the code before processing).

Re: Strangest Programming Language Feature?

#44
post #6

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

f p=2,3:2 s q=1 x "f f=3:2 q:f(asterisk)f>p!'q s q=p#f" w:q p,?$x\8+1 8 (Not sure if this is going to mess up the formatting, so apologies in advance). This (shamelessly stolen from a usenet sig) will print out a table of primes with formatting. Adding a quit based on max prime size is left as exercise to the reader. Explanation: f = for, but basically used as a while loop since we don't have a terminate condition ('…

That's actually more readable than APL, and once you said "f = for" I automatically made the mental association "s = set" and "x = execute". It wasn't actually that hard to figure out the rest from that...

and something about that code reminds me of vi commands.

Re: Strangest Programming Language Feature?

#45
post #28

I heart what should be called a "truth injection attack" in Python: http://stackoverflow.com/a/2021553/109618

You can do a similar thing with Java, although it's a bit harder... http://stackoverflow.com/questions/3301635/change-private-st...

I think you can do something like this in C# too (not surprisingly).

Re: Strangest Programming Language Feature?

#46
post #35

In CoffeeScript I discovered the other day that: 0

I guess that is because coffeescript's but coffeescript's "is", aka ==, aka === in javascript, doesn't.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

having "==" be semantically quite different to "arguably coffeescript has made things worse in this case compared to plain javascript, where you're probably not going to expect === to behave similarly to not obvious how you'd improve this to make it consistent, without say redefining how "==" and "<=" work to make them raise type errors or evaluate to something undefined if the types of the arguments don't match.

Re: Strangest Programming Language Feature?

#47
C++ has all sorts of fun stuff. One example is std::vector, which is not implemented as a simple array of booleans like every other std::vector, but instead it is a bitmap. Afaik this behavior is required by standard. One fun side-effect is that you can't take the address of individual elements of the vector.

Compare these two:

http://ideone.com/qC9yOp

http://ideone.com/jF4krp

Re: Strangest Programming Language Feature?

#49
post #35

In CoffeeScript I discovered the other day that: 0

It's because equality comparisons in CoffeeScript (==, !=, is, isnt) are always compiled into strict (non-type-converting) comparisons (===, !==). [1]

JavaScript doesn't have strict relational operators (>, =,

  CoffeeScript: 0 
[1]: http://coffeescript.org/#operators

[2]: http://www.ecma-international.org/ecma-262/5.1/#sec-11.8

EDIT: Forgot to include 'is' and 'isnt' operators.

Re: Strangest Programming Language Feature?

#50
post #3

Smalltalk's "become" is a pretty interesting one... http://gbracha.blogspot.it/2009/07/miracle-of-become.html

Smalltalk also is rather famous for giving developers enough freedom to more or less destroy the environment with the terrifying looking command "Smalltalk := nil"

I once crashed Squeak by making true := false. It was an interesting experience.
Post reply on HN