chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] substring function and bounds checks


From: Moritz Heidkamp
Subject: Re: [Chicken-hackers] substring function and bounds checks
Date: Wed, 06 Feb 2013 00:10:09 +0100

Hi Michele,

Michele La Monaca <address@hidden> writes:

> Maybe this is not the right list for that, sorry.

yeah, this one probably better fits chicken-users as it's not really
about Chicken's implementation, so you might be losing some broader
audience by posting it here. No problemo, though!


> In fact, it makes the usage of substring "unsafe" and the
> countermeasures I can imagine (manual bounds checks, padding, writing
> my-own-substring-function, whatever) are quite unsatisfactory... to me
> at least.

I felt the same when coming to Scheme (from Ruby in my case). But after
having been immersed in the langauge and community surrounding it for a
while now I came to see it in a different light: What might look like
impracticality at the beginning turns out to be a virtue in its own
right. All languages you cite (well, apart from Python perhaps, as Peter
noted) are from the DWIM-most-of-the-time spectrum which give a lot of
leeway. This often leads to what Olin Shivers vividly describes as 80%
solutions in the preamble of the SRE announcement (see
http://www.scsh.net/docu/post/sre.html). I recommend you to read that
one if you don't already know it. Scheme as a whole tries to aim for the
100% solutions (whether it's successful in that endeavor is open for
debate, of course). That's why you'll often see functions reduced to
their bare minimum purpose and correct behavior even in edge cases. This
is especially true for functions defined in the standard core such as
the one you are referring to. The nice thing is that from that solid
core as a foundation we can build libraries which allow us to be a bit
more sloppy when we want to whereas it's much harder to go the other way
around.

It may sound a bit like "just drink the Kool-Aid" but what I'm trying to
say is: Scheme, as any language, has its own culture and you will be
much happier when you try to embrace it rather than trying to impose
concepts from other languages on it. But you probably already know this,
so I hope my comment on the specific case of your substring issue is of
help, anyway :-)


Moritz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]