Scheme needs traits/properties

I just came across this post about the lack of good error reporting in the PLT scheme webserver:

I’m a fan of the PLT Scheme web-server. (I better be or else find another job!) But I get an error message like:
Servlet exception: "car: expects argument of type ; given #"

And when you have 2000 lines of code across four files, not to mention that it might not have been you who called car directly, you start to think, “will I ever find this bug?”

Could I get a line number, or any additional information from the web-server? No. And the bug I filed was closed without resolution in a record 4 minutes.

Now I don't actually know the real reason why the PLT folks don't want to give a line number with their error messages, but I'm going shoot my mouth off and assume it has something to do with the fact that the exception object they're throwing simply doesn't have that information currently, and has nowhere to put it without changing the object type and thereby breaking existing code. In fact I suspect they're throwing a simple string, and not a structured data type.


Perl 6's properties would solve this problem handily. You would continue to throw a string, but you'd also tag it with a file and line number. Existing code could treat the object just like a plain old string, but new code could look for the extended information.

I notice that the Scheme community may be putting together an R6RS soon. I looked at the draft charter, and it seemed astonishingly conservative. For example, they're completely ignoring ad-hoc polymorphism (whether you implement it as multimethods, type-classes or interfaces). It's so annoying to distinguish map, which only works for lists, from map-vector and map-string.

At least they're planning on supporting unforgeable user data types. That one's only overdue by, oh, I'd say about 20 years...

I'll grant that Scheme's raison d'etre is more as a framework for describing computation, rather than as a language that's useful for actual programming. But that leaves no incentive for people use it to actually write programs, unless they're interested in playing around with language features (like I am).

Posted on November 14, 2003 01:20 PM
More languages articles

Comments
Post a comment









Remember info?




Prove you're human. Type "human":