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

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02802] Re: Array.pop and documentation [was:Appendalias for Array.append?]

From: Albert Wagner <alwagner@...>
Date: 2000-05-13 03:04:09 UTC
List: ruby-talk #2802
You seem to be using the word "slice" in a context where "truncate" is
more appropriate. Truncate means to shorten by chopping off an end. So
that: 

truncateHead 3    # would chop 3 off the head
truncateTail 3    # would chop 3 off the tail

Whereas slice(n,m) could remove from the middle as well as the end.

slice(-5,3)       # removes 3 starting at 5 from the tail 
slice(5,3)        # removes 3 starting at 5 from the head

However, you make your best point here:
> 1) 
> Version using two arguments compared to named version is shifting action
> from named functionality to the direction where semantic meaning is hided
> inside syntax.
>
> One could ask why stop to slice(0,1) version? We could transform all the
> function names to certain numbers and write instead '283(0,1)' and actually
> punctuation eases things, so maybe we should get rid of it too.

For readability you can't beat Smalltalk:

anArray.sliceFromPos: int forLengthOf: int   # now that's a readable
signature, or
aDictionary.atKey: var putValue: var

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.  

Albert

---
Small is Beautiful

In This Thread