Kalman N. wrote:
It seems that this pattern has been quite popular for some time already.
It may be desirable for the list to try and agree on a great name for the
method. Anyone who implements it calls it differently: Object#then,
Object#with, Object#tap, Kernel#returning, Kernel#with, … Anyone with
arguments for or against certain names, or with a better name for the
method?
I suppose I’ll cast my vote for either “with” or “suchthat” or even “:”
(though IIRC, “:” can’t be a method name). They are all idiomatic in
mathematical circles when introducing a new mathematical object in an
argument. To be fair, the colon is shorthand for “such that”. Though
there are some stylistic/usage differences between “with” and “such
that”, they are synonymous.
Examples:
Let V be a normed vector space. Let B be an orthogonal basis such that
each element b in B has length 1.
Let V be a vector space with orthonormal basis B.
Most (all?) of my programming work mirrors formal arguments and
designs, which is the primary reason I chose to work with an OO
language. That is, I introduce objects, operate on them, reason about
them, and terminate. Anything to bridge (increasingly smaller)
conceptual gap is helpful. I feel a lot more productive if my code
reads like the examples above. (This is also why I worked with Perl
before – a lot of Perl reads like slightly formal, idiomatic English
to me.)
It seems to me that it’s impossible to invent a useful name for this
method with the term »eigen« in it, so a discussion should be possible
without too much battle.
Interesting. Why “eigen”? I don’t know much German, but as far as I
know, “eigen” means something along the lines of “characteristic of” or
“particular to”. I can see the relation, but it somehow seems
linguistically backwards, since the code block is particular to the new
object created, instead of the object created being particular to the
code block.
'cid 'ooh
(Sorry if this is a repost. Google is broken)