News for hackers. Stuff that matters.
Re:CaterwaulJS "Nobody in their right mind would use this la... by andolanra on Friday December 09, 2011 @11:23PM (#3336907)
Somewhat off-topic: the author repeatedly suggests that prefix notation isn't as pleasant to read as infix because natural language uses a Subject-Verb-Object ordering. Most human languages actually use a Subject-Object-Verb ordering (e.g. Japanese, Turkish, Hindi, &c), but I've never heard of anyone from any of these other cultures implementing an SOV programming language[1]. Does anyone know whether this kind of reasoning (i.e. "This is more intelligible to me because my natural language does it as well") has ever been actually researched? (Unfortunately, when it comes to things like language, someone's gut feeling can be deeply and remarkably wrong.)

[1]: As far as I can recall, this and Perl's Lingua::tlhInganHol::yIghun are the only languages I've seen that really have postfix functions. I could be wrong.

Re:CaterwaulJS "Nobody in their right mind would use this la... by premchai21 on Saturday December 10, 2011 @12:14AM (#3336992)
Stack languages like Forth and PostScript could reasonably be considered SOV. In PostScript, even control flow words come at the end, with subordinate clauses being deferred by curly braces: « (Hello, world!) 2 2 add 5 eq { 0 5 getinterval } { 7 6 getinterval } ifelse » places the string "world!" on the stack.
Re:CaterwaulJS "Nobody in their right mind would use this la... by LeafStorm on Friday December 09, 2011 @11:39PM (#3336935)
> Does anyone know whether this kind of reasoning (i.e. "This is more intelligible to me because my natural language does it as well") has ever been actually researched?

Researched? Not that I know of. But I know that Larry Wall tried to do this with Perl (i.e. the @array vs. $array[item] distinction as a parallel to the use of plurals in natural language). I'm not sure it really worked out well. Part of it could be due to bad interactions with all the punctuation and Huffman coding, but I think another reason is that programmers expect a more regular and mathematical notation from a programming language, rather than a linguistic notation.

> As far as I can recall, this and Perl's Lingua::tlhInganHol::yIghun are the only languages I've seen that really have postfix functions. I could be wrong.

PostScript has postfix functions, due to its nature as a stack-oriented language.

Re:CaterwaulJS "Nobody in their right mind would use this la... by LukeShu on Saturday December 10, 2011 @07:59AM (#3337507)
I've always held that if you name your methods and variables right, many lines of code can be read as sentences.

When describing the fetchmail config syntax, ESR commented that you should be weary of making something too much like natural language and too complex, but that he added certain optional tokens that get filtered out to make the syntax more readable.

Like the `wtf' command (from BSD?). It tells you what something means. The syntax is "wtf [is] <acronym>". To a unixhead, the is isn't necessary, but it makes the command read like a sentence.

If I'm willing to add in those little words, I find the best lines of code will read like a sentence

  if (foo.equals(bar)) { /* then */
    ...
or

  mv file [to] newname
Re:CaterwaulJS "Nobody in their right mind would use this la... by michaelcampbell on Saturday December 10, 2011 @10:54AM (#3337748)
I do that sometimes with java code. My support guys have given me some "thanks, your code is easy to read" type emails occasionally. Good naming helps, although some consider it overly verbose. To wit:

    public static final BigDecimal BY_100 = new BigDecimal("100.00");
    ...
    BigDecimal amountInDollars = amountInCents.divide(BY_100);
Sometimes I do it just for my own amusement, too.
Re:CaterwaulJS "Nobody in their right mind would use this la... by sjs on Saturday December 10, 2011 @12:20AM (#3337004)
The source is almost as interesting as the language. Craziest HTML I have ever seen render so nicely. It's a self-modifying Perl program.
Re:CaterwaulJS "Nobody in their right mind would use this la... by walrus on Saturday December 10, 2011 @12:41AM (#3337049)
The author of Caterwaul, Spencer Tipping, has a document (which is a self-modifying Perl program itself) explaining the technique.

https://github.com/spencertipping/writing-self-modifying-per...

Re:CaterwaulJS "Nobody in their right mind would use this la... by Quiark on Saturday December 10, 2011 @02:21PM (#3338220)
Any ideas what is this good for? I'm sure it's a nice intellectual exercise, but does it simplify something or make some cool tricks possible?
Re:CaterwaulJS "Nobody in their right mind would use this la... by spencertipping on Saturday December 10, 2011 @05:26PM (#3338670)
I originally wrote it for that reason: it's sort of a mind-bending exercise and I wanted to see if it could be done. (The first attempt was actually in Bash, but that didn't work at all.) Since refining the implementation a bit, I've found these scripts to be unexpectedly useful. I mainly use them to encapsulate things like build rules, though now they have an inheritance hierarchy and some standard library functions that I reuse. Because these scripts are self-contained, I can upgrade library code without breaking old projects.

The coolest thing about these files, I think, is that they support inheritance from one another and are fairly smart about it. (This feature didn't exist at first, and as a result they were impossible to manage.) If you locally modify one to differ from one of its parents, it makes a note of this and preserves your changes to the modified attributes during upgrades. I use this on the Caterwaul page to provide custom HTML -- most scripts load some Javascript that shows you the attribute table.

Re:CaterwaulJS "Nobody in their right mind would use this la... by keyle on Friday December 09, 2011 @09:07PM (#3336645)
Great language nonetheless.

I recommend this read, I found it greatly entertaining and very cool.

http://www.caterwauljs.org/doc/caterwaul-by-example.pdf

Re:CaterwaulJS "Nobody in their right mind would use this la... by bilalhusain on Saturday December 10, 2011 @12:16PM (#3337923)
"genius"

- me, an average programmer n wannable programming languages enthusiast (read lusts for haskell, lamdba, monad, contracts, traits, type theory but never attempts it and upvotes any remotely related submission), after looking at the Caterwaul by example pdf and the website's html source code

Re:CaterwaulJS "Nobody in their right mind would use this la... by spencertipping on Saturday December 10, 2011 @01:46PM (#3338138)
Two questions: First, may I quote you; and second, are you being sarcastic? (Because if you are, then I really want to quote you.)
Re:CaterwaulJS "Nobody in their right mind would use this la... by bilalhusain on Saturday December 10, 2011 @02:52PM (#3338317)
Humbled.

If only quotes came with an artistic interpretation license...

Psst, thank you for Caterwaul. Its amazing things like these which make me feel insignificant!

Re:CaterwaulJS "Nobody in their right mind would use this la... by nchuhoai on Friday December 09, 2011 @11:00PM (#3336874)
Am I the only one who finds this font horrible to read?
Re:CaterwaulJS "Nobody in their right mind would use this la... by Semiapies on Friday December 09, 2011 @11:46PM (#3336946)
I found it easier once I zoomed in.
Re:CaterwaulJS "Nobody in their right mind would use this la... by mansoor-s on Friday December 09, 2011 @11:50PM (#3336956)
yah, you are right. It looks nice but is very hard to read.
Re:CaterwaulJS "Nobody in their right mind would use this la... by michaelcampbell on Saturday December 10, 2011 @10:56AM (#3337755)
Very interesting.

Does the font render as ... ugly, to anyone else? I'm on a Windows box using chrome, and it looks awful to me. Here's what it looks like: http://img585.imageshack.us/i/image000kr.png/

Re:CaterwaulJS "Nobody in their right mind would use this la... by donatzsky on Saturday December 10, 2011 @11:42AM (#3337853)
Same thing here. Some fonts seem to do that (like the Helvetica that came with my printer driver - ugly internet for a while there) not sure why. I'm on XP using Firefox.