Lambda the Ultimate

inactiveTopic It all depends on what you mean by ($f)
started 6/4/2001; 12:21:56 PM - last post 6/6/2001; 2:11:43 AM
Ehud Lamm - It all depends on what you mean by ($f)  blueArrow
6/4/2001; 12:21:56 PM (reads: 1709, responses: 3)
It all depends on what you mean by ($f)
A Perl quiz: what is the difference between

my $f = `fortune`;

and

my ($f) = `fortune`;


The answer: a police record. Sounds incredible -- but true.

One teenager was not aware of that difference and ended up with a police record. The article lucidly explains what happened.

As Oleg puts it: "The accident makes everyone appreciate the context of Perl operators,and the fact that parentheses sometimes can make a huge difference. It's noteworthy that Randal Schwartz seems to acknowledge that Perl is a mess, with no fixed and consistent rules."


Thanks, Oleg!


Posted to fun by Ehud Lamm on 6/4/01; 12:23:35 PM

Chris Rathman - Re: It all depends on what you mean by ($f)  blueArrow
6/5/2001; 1:16:15 AM (reads: 887, responses: 0)
For some reason, the philosophy of Perl reminds me of C++ 10x over. IIRC, Stroustrap said something in the 'Design and Evolution of C++' to the effect that all languages have complexity, it's just a matter of whether that complexity is pushed into the syntax or whether it's in the libraries.

Perl & C++ have a very definitive slant to pushing complexity into the syntax. For some strange reason, most programmers seem to prefer having complex syntax - witness the popularity of Java, C++, Perl, VB, etc...

My take on the issue is that many would rather have programming language syntax do their thinking for them, rather than to have to look up libraries - especially when more than one variety of a library solution exists. Register me as a pessimist, but I think that programmers seem to like languages that push the complexity into syntax. Simplicity of syntax seems to be an underrated commodity.

Ken Shan - Re: It all depends on what you mean by ($f)  blueArrow
6/5/2001; 8:59:32 AM (reads: 866, responses: 0)
On another note, did the copy editor change the forward quotes into backward quotes? It should be `fortune`, not `fortune'. Heh.

Ehud Lamm - Re: It all depends on what you mean by ($f)  blueArrow
6/6/2001; 2:11:43 AM (reads: 874, responses: 0)
Simplcity of synatx (see Scheme) is a wonderful thing for some purposes. But in a certain sense it only leads you to create DSL (aka 'stratified design') to enable you to have a language that provides syntactic abstractions. I just wrote something close to this on comp.lang.ada