Re: left, right? head, tail? which one?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt Lewis wrote:
> 
> Jeremy Cowgar wrote:
> > 
> }}}
<eucode>
>   left("John Doe", 4) -- "John"
>   left({{1,2},{3,4},{5,6}}, 2) -- {{1,2},{3,4}}
>   right("John Doe", 3) -- "Doe"
>   tail("John Doe", 3) -- "Doe"
>   pad_left("ABC", 6) -- "   ABC"
>   pad_head("ABC", 6) -- "   ABC"
>   pad_tail("ABC", 6) -- "ABC   "
>   trim_tail("ABC   \r\n\t", 0) -- "ABC"
>   trim_head("...ABC", '.') -- "ABC"
>   trim_head("\r\t\nDEF ABC", "\tFD\n E") -- "ABC"
> </eucode>
{{{

> 
> My thought is, "Is there really a need for this stuff?"  There are better
> ways to do this in euphoria.  This seems like a very BASIC-y way to do 
> things.  I don't think we should include this in the standard library.
> 
> Well, the trim stuff is useful, but should probably live in string.e.

Somebody earlier stated that they were probably the least competent Euphoria
programmer commenting here.  I beg to differ.

With that in mind, sometimes the "old" way of doing things is the best way as it
leverages prior knowledge, lowers barriers to understanding and generally makes
the language easier to propagate.

Unless there is a compelling reason to use a descriptor which is different, I
would argue for using the BASIC-y way of doing things.  That is, if the
descriptor is perfectly apt when dealing with strings, let the standard be that
anything which does work with strings also will work with sequences.

It has taken me a while to get my head around the overloading of the sequences
type with both strings and sequences (oh, if I had a nickel for each compilation
that resulted in the "sequence found within character string" error).  But now
that I have, I don't want to forget the fact that this most elegant of features
is, as the documentation says, "IT" and that just because the documentation says
it doesn't mean that the reader actually GETS it until later.  In my case, MUCH
later.

With that said as more background, I'll restate the above in the following
manner: for each function I can immediately understand because it is BASIC-y, 
the barrier for me to adopt Euphoria for my programming needs lowers.  The best
way to communicate that to the EU newbie is a name which is both familiar and
apt.

Please don't interpret the above as saying you should always use names that are
archaic.  New concepts scream out for new descriptors.  Hacking the first few
things off for later use (or the last) is about as basic (not BASIC) as one can
get.

Mike

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu