[racket] syntax, differently

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Wed Aug 18 12:30:43 EDT 2010

On 18.08.10 17:18, Shriram Krishnamurthi wrote:
> Separate from that is the reaction when something isn't present in the
> association.  There is nothing preventing o.f -- which, as we've
> noted, is really o["f"] in these languages -- from halting with an
> error when "f" isn't associated with o.  If Racket were to adopt an
> association syntax, I sure hope this is what it would do semantically.
>
> Sadly, the scripting languages prefer to continue evaluating with
> nonsense.  And that's the value judgment.

AFAIK this only holds for JavaScript (which returns undefined for all 
undefined members and variables) and JavaScript has worse offenders than 
this unfortunately. ("3" + 3) anyone? ;] IIRC Perl also does something 
like this for hash tables (but not for variables).

I am sure that Python throws an exception (dunno about Ruby).

Objective-C OTOH does a funny thing when you send a message (call a 
method) to a nil (NULL) object because it simply ignores the message and 
returns an unspecified value. But it does throw an exception when you 
send an unsupported message to a valid object.

-- 
regards,
Jakub Piotr Cłapa


Posted on the users mailing list.