[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02805] Re: Array.pop and documentation [was: Append alias for Array.append?]

From: "Conrad Schneiker" <schneiker@...>
Date: 2000-05-13 07:02:54 UTC
List: ruby-talk #2805
Hi,

From: Albert
> For readability you can't beat Smalltalk:
>
> anArray.sliceFromPos: int forLengthOf: int   # now that's a readable
> signature, or
> aDictionary.atKey: var putValue: var

Sort of looks like COBOL done right and made worth keeping around.

> For readability you are already limited by function syntax: name(arg1,
> arg2, ...).
> If readability is a high priority then the best you can do with function
> syntax is keyword args.  You have noticed how, when reading new code
> such as:
>
> functionName("Once...", 13, name, ':', name, name)
>
> You can't tell a thing about what is happening without looking at the
> code of functionName and examining what happens to each arg.

Well readability is a high priority up to a point. So is convenience. So is
simplicity. So is synergy. So is naturalness. And these all involve tricky
trade-offs, which precludes any sort of mono-dimensional priority. Well
known standard functions with 0 or 1 parameters are simple, readable, and
convenient and so are nice to have, even though reading new code with
user-defined many-parameter functions is (often) troublesome, as you noted.

As for "truncate" in place of "slice", I prefer the more terse "chop",
giving:

    chop_start
    chop_start(n)
    chop(m,n)
    chop_end(n)
    chop_end

Conrad

In This Thread

Prev Next