February 10, 2011
On 2011-02-09 21:09, Daniel Gibson wrote:
> Am 09.02.2011 21:08, schrieb Ary Manzana:
>> On 2/9/11 3:54 PM, bearophile wrote:
>>> - There is no need to learn to use a function with a weird syntax like iota,
>>> coming from APL. This makes Phobos and learning D a bit simpler.
>>
>> I would recommend stop using "weird" names for functions. Sorry if this sounds a
>> little harsh but the only reason I see this function is called "iota" is to
>> demonstrate knowledge (or to sound cool). But programmers using a language don't
>> care about whether the other programmer demonstrates knowledge behind a function
>> name, they just want to get things done, fast.
>>
>> I mean, if I want to create a range of numbers I would search "range". "iota"
>> will never, ever come to my mind. D has to be more open to public, not only to
>> people who programmed in APL, Go or are mathematics freaks. Guess how a range is
>> called in Ruby? That's right, Range.
>>
>> Another example: retro. The documentation says "iterates a bidirectional name
>> backwards". Hm, where does "retro" appear in that text? If I want to iterate it
>> backwards, or to reverse the order, the first thing I would write is
>> reverse(range) or backwards(range), "retro" would never come to my mind.
>>
>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>
> I agree that iota is a bad name, but "Range" is a bad name because it's already
> used in D.
>
> Cheers,
> - Daniel

But "range"?

-- 
/Jacob Carlborg
February 10, 2011
spir wrote:
> Even then, noone forces D2 to blindly reproduce stupid naming from APL/C++, I guess. Or what?
> 
	Actually, I thought that D had set out to *fix* the stupid mistakes
from C++...

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



February 10, 2011
On 2/10/11 9:47 AM, spir wrote:
> On 02/10/2011 04:34 PM, Max Samukha wrote:
>> On 02/10/2011 05:18 PM, Andrei Alexandrescu wrote:
>>> On 2/10/11 12:30 AM, Olivier Pisano wrote:
>>>> Le 09/02/2011 21:08, Ary Manzana a écrit :
>>>>> On 2/9/11 3:54 PM, bearophile wrote:
>>>>>> - There is no need to learn to use a function with a weird syntax
>>>>>> like
>>>>>> iota, coming from APL. This makes Phobos and learning D a bit
>>>>>> simpler.
>>>>>
>>>>> I would recommend stop using "weird" names for functions. Sorry if
>>>>> this
>>>>> sounds a little harsh but the only reason I see this function is
>>>>> called
>>>>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>>>>> using a language don't care about whether the other programmer
>>>>> demonstrates knowledge behind a function name, they just want to get
>>>>> things done, fast.
>>>>>
>>>>> I mean, if I want to create a range of numbers I would search "range".
>>>>> "iota" will never, ever come to my mind. D has to be more open to
>>>>> public, not only to people who programmed in APL, Go or are
>>>>> mathematics
>>>>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>>>>
>>>>> Another example: retro. The documentation says "iterates a
>>>>> bidirectional
>>>>> name backwards". Hm, where does "retro" appear in that text? If I want
> Path: digitalmars.com!not-for-mail
> From: Regan Heath <regan@netwin.co.nz>
> Newsgroups: digitalmars.D
> Subject: Re: Lookup conventions: [Was Re: Get vs Test method naming
> convention]
> Date: Thu, 15 Jul 2004 12:25:06 +1200
> Organization: Netwin LTD
> Lines: 145
> Message-ID: <opsa5kr4zf5a2sq9@digitalmars.com>
> References: <cd30iv$17m8$1@digitaldaemon.com>
> <cd3qim$2iov$1@digitaldaemon.com> <cd481o$adi$4@digitaldaemon.com>
> <cd4dqj$m1f$1@digitaldaemon.com> <cd4gnr$rp0$1@digitaldaemon.com>
> Mime-Version: 1.0
> Content-Type: text/plain; format=flowed; charset=iso-8859-15
> Content-Transfer-Encoding: 8bit
> X-Trace: digitaldaemon.com 1089851223 33174 210.54.44.56 (15 Jul 2004
> 00:27:03 GMT)
> X-Complaints-To: usenet@digitalmars.com
> NNTP-Posting-Date: Thu, 15 Jul 2004 00:27:03 +0000 (UTC)
> User-Agent: Opera7.23/Win32 M2 build 3227
> Xref: digitalmars.com digitalmars.D:6162
>
> On Thu, 15 Jul 2004 09:47:52 +1000, Matthew
> <admin@stlsoft.dot.dot.dot.dot.org> wrote:
>> "Sean Kelly" <sean@f4.ca> wrote in message
>> news:cd4dqj$m1f$1@digitaldaemon.com...
>>> In article <cd481o$adi$4@digitaldaemon.com>, Matthew says...
>>> >
>>> >Fair point
>>> >
>>> >What about:
>>> >
>>> > - value_type getXyz(key_type key) returns the requested element, or
>> throw
>>> >InvalidKeyException
>>> > - bool containsXyz(key_type key) returns true/false, indicating
>> presence
>>> >of element
>>> > - value_type findXyx(key_type key, value_type defaultValue) returns
>>> the
>>> >requested element, or the given default
>>> >
>>> > - opIndex() is a synonym for getXyz where the container has only a
>> single
>>> >value_type, or its primary value_type is obviously delineated from any
>> secondary
>>> >value_types.
>>> >
>>> >I'm pretty happy with this picture. Votes?
>>>
>>> I don't like the new findXyz semantics. The new function requires that I
>> either
>>> set aside a potentially valid value to signal lookup failure, do two
>>> lookups
>>> (one for containsXyz and another for findXyz), or wrap getXyz in a
>>> try block.
>>> Another possibility would be to offer two versions of findXyz, one
>>> accepting a
>>> default and one returning a pointer?
>>
>> Can you provide a quick sample of using a findXyz() that illustrates your
>> requirement?
>>
>>
>> Ok, assuming that everyone's on board with testing (by opIn and/or
>> contains()
>> and/or containsXyz()) and getting (opIndex and/or get() and/or
>> getXyz()), then
>> it's finding that's the trouble.
>>
>> What are our requirements for finding:
>>
>> To be able to determine presence (testing) and retrieve the element in
>> the case of its being present.
>>
>> To determine presence we must either return a boolean or sentinel
>> value (e.g.
>> null). Given the dichotomy between null being a good (but not perfect)
>> sentinel
>> for object types, and 0/NaN being a bad sentinel for built-in types,
>> I'd now
>> suggest that we don't do that. Hence, presence should be indicated
>> either by
>> return value, or by an out parameter.
>> Retrieval can similarly be return value or out parameter.
>>
>> Thus, for finding, we have two options
>>
>> 1. Return the value, pass the presence as an out parameter
>>
>> value_type findXyz(key_type key, out bool bPresent);
>>
>> 2. Return the presence, pass the value as an out parameter
>>
>> bool findXyz(key_type key, out value_type value);
>
> I like #2, it allows this...
>
> if (findXyz("regan",value)) {
> }
>
> #1 would be
>
> value = findXyz("regan",r);
> if (r) {
> }
>
>> I'd suggest here and now that neither of these are going to satisfy all
>> circumstances. I'd further suggest, however, that we need to decide on
>> one and
>> stick to it.
>
> My vote is for #2 above.
>
>> btw, considering all this, it now seems to me that the above
>> definition of
>> findXyz(), incorporating a default value, is quite wrong. That should
>> be called
>> something else, findWithDefault[Xyz](), or something less ugly.
>
> True, having a default value requires being able to pass 'no default',
> which is the null/0/NaN problem all over again.
>
> Do we need this at all, consider:
>
> if (!findXyz("regan",value)) value = "default";
> ..use value here..
>
>> Leaving us with the following lookup "conventions":
>>
>>>>> to iterate it backwards, or to reverse the order, the first thing I
>>>>> would write is reverse(range) or backwards(range), "retro" would never
>>>>> come to my mind.
>>>>>
>>>>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>>>>
>>>> Hi,
>>>>
>>>> I agree iota is a bad name.
>>>
>>> Fifth result of simply googling the entire Web for "iota":
>>>
>>> http://www.sgi.com/tech/stl/iota.html
>>>
>>>
>>> Andrei
>>
>> Google search takes your preferences into account. They must be
>> tracking your
>> search history, peeking into your gmail accounts etc. I searched for
>> 'iota' and
>> couldn't find the STL link on the first 5 pages.
>
> Even then, noone forces D2 to blindly reproduce stupid naming from
> APL/C++, I guess. Or what?

I don't find the name "iota" stupid.

Andrei
February 10, 2011
On 2/10/11 9:49 AM, Ary Manzana wrote:
> On 2/10/11 12:34 PM, Max Samukha wrote:
>> On 02/10/2011 05:18 PM, Andrei Alexandrescu wrote:
>>> On 2/10/11 12:30 AM, Olivier Pisano wrote:
>>>> Le 09/02/2011 21:08, Ary Manzana a écrit :
>>>>> On 2/9/11 3:54 PM, bearophile wrote:
>>>>>> - There is no need to learn to use a function with a weird syntax
>>>>>> like
>>>>>> iota, coming from APL. This makes Phobos and learning D a bit
>>>>>> simpler.
>>>>>
>>>>> I would recommend stop using "weird" names for functions. Sorry if
>>>>> this
>>>>> sounds a little harsh but the only reason I see this function is
>>>>> called
>>>>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>>>>> using a language don't care about whether the other programmer
>>>>> demonstrates knowledge behind a function name, they just want to get
>>>>> things done, fast.
>>>>>
>>>>> I mean, if I want to create a range of numbers I would search "range".
>>>>> "iota" will never, ever come to my mind. D has to be more open to
>>>>> public, not only to people who programmed in APL, Go or are
>>>>> mathematics
>>>>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>>>>
>>>>> Another example: retro. The documentation says "iterates a
>>>>> bidirectional
>>>>> name backwards". Hm, where does "retro" appear in that text? If I want
>>>>> to iterate it backwards, or to reverse the order, the first thing I
>>>>> would write is reverse(range) or backwards(range), "retro" would never
>>>>> come to my mind.
>>>>>
>>>>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>>>>
>>>> Hi,
>>>>
>>>> I agree iota is a bad name.
>>>
>>> Fifth result of simply googling the entire Web for "iota":
>>>
>>> http://www.sgi.com/tech/stl/iota.html
>>>
>>>
>>> Andrei
>>
>> Google search takes your preferences into account. They must be tracking
>> your search history, peeking into your gmail accounts etc. I searched
>> for 'iota' and couldn't find the STL link on the first 5 pages.
>
> Same here. And 5th isn't very good. 1st is very good. :-P

One misconception is that iota is a range of numbers. It's not. The step is an important part of it.

Andrei
February 10, 2011
Andrei Alexandrescu Wrote:
> 
> I don't find the name "iota" stupid.

I never entirely understood the name choice.  I suppose "iota" could be related to a "small step" so iota(1,5) is a series of small steps from 1 to 5?
February 11, 2011
"Max Samukha" <maxsamukha@spambox.com> wrote in message news:ij10n7$25p0$1@digitalmars.com...
> On 02/10/2011 05:18 PM, Andrei Alexandrescu wrote:
>> On 2/10/11 12:30 AM, Olivier Pisano wrote:
>>> Le 09/02/2011 21:08, Ary Manzana a écrit :
>>>> On 2/9/11 3:54 PM, bearophile wrote:
>>>>> - There is no need to learn to use a function with a weird syntax like iota, coming from APL. This makes Phobos and learning D a bit simpler.
>>>>
>>>> I would recommend stop using "weird" names for functions. Sorry if this sounds a little harsh but the only reason I see this function is called "iota" is to demonstrate knowledge (or to sound cool). But programmers using a language don't care about whether the other programmer demonstrates knowledge behind a function name, they just want to get things done, fast.
>>>>
>>>> I mean, if I want to create a range of numbers I would search "range". "iota" will never, ever come to my mind. D has to be more open to public, not only to people who programmed in APL, Go or are mathematics freaks. Guess how a range is called in Ruby? That's right, Range.
>>>>
>>>> Another example: retro. The documentation says "iterates a
>>>> bidirectional
>>>> name backwards". Hm, where does "retro" appear in that text? If I want
>>>> to iterate it backwards, or to reverse the order, the first thing I
>>>> would write is reverse(range) or backwards(range), "retro" would never
>>>> come to my mind.
>>>>
>>>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>>>
>>> Hi,
>>>
>>> I agree iota is a bad name.
>>
>> Fifth result of simply googling the entire Web for "iota":
>>
>> http://www.sgi.com/tech/stl/iota.html
>>
>>
>> Andrei
>
> Google search takes your preferences into account. They must be tracking your search history, peeking into your gmail accounts etc. I searched for 'iota' and couldn't find the STL link on the first 5 pages.

Yea, it's definitely user-specific. It's on the thrid page for me. But the second result on the first page is the Wikipedia page for "Iota" which mentions the following meanings:

- A greek letter
- A small amount
- "Imaginary" constant
- The "definite descriptor" (symbolic logic).
- The unit vector (but generally with a superscribed caret)

The only reference on the page to a sequence of integers is in direct reference to APL (which is kind of obsure outside numerical-computation) and *ahem* "Issue 9" (which isn't exactly a fountain of good ideas to be stolen).

Additionally, keep in mind that on that SGI/STL page, it states "This function is an SGI extension; it is not part of the C++ standard". So it's not even C++ or STL at all, it's a non-standard SGI extension (And is SGI stuff even used anymore anyway? Do they even exist as what we know "SGI" as being anymore?).



February 11, 2011
"Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> wrote in message news:ij1nkf$i7g$2@digitalmars.com...
>
> I don't find the name "iota" stupid.
>

Far as I can tell, you seem to be nearly the only one who finds it to be a good name. I can live with it, since I've just simply learned that in D "iota(x,y)" means "range of integers from [x,y)". And the controversy over it's name helps me to remember. But still, I'm yet another in the seemingly much larger camp of "The word 'iota' doesn't remotely reflect what it does". Additionally, I've never known any other meaning for "iota" besides "vey small amount", I've never used APL, and I've certainly never used non-standard SGI extensions to C++.

(Actually, the first time I saw "iota()", my thought was "Wait, I thought D used the much more readable to!string(7)...oh, wait, that says iota, not itoa..." But that might just be my problem ;) )

FWIW, I do like "retro".


February 11, 2011
On Thursday, February 10, 2011 17:45:21 Nick Sabalausky wrote:
> "Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> wrote in message news:ij1nkf$i7g$2@digitalmars.com...
> 
> > I don't find the name "iota" stupid.
> 
> Far as I can tell, you seem to be nearly the only one who finds it to be a good name. I can live with it, since I've just simply learned that in D "iota(x,y)" means "range of integers from [x,y)". And the controversy over it's name helps me to remember. But still, I'm yet another in the seemingly much larger camp of "The word 'iota' doesn't remotely reflect what it does". Additionally, I've never known any other meaning for "iota" besides "vey small amount", I've never used APL, and I've certainly never used non-standard SGI extensions to C++.
> 
> (Actually, the first time I saw "iota()", my thought was "Wait, I thought D
> used the much more readable to!string(7)...oh, wait, that says iota, not
> itoa..." But that might just be my problem ;) )
> 
> FWIW, I do like "retro".

I feel pretty much the same way. iota seems like a horrible name as far as figuring out what the function does from its name goes. I don't know what a good name would be though (genSequence?), but since I know what it does, it doesn't confuse me when I see it. It does have the advantage of being short at least.

So, I don't think that it's a good name, but I don't think that it's worth changing either. retro is a good name though. But there _are_ going to be functions with relatively poor names, and it's not like we'll ever get agreement on all function names anyway.

- Jonathan m Davis
February 11, 2011
> Google search takes your preferences into account. They must be tracking your search history, peeking into your gmail accounts etc.

I sooo hate that, it kills the very meaning of searching!
February 11, 2011
Make to! smarter?

auto someRange = to!range(0, 5);

Here's python:
>>> range(5, 10)
[5, 6, 7, 8, 9]
>>> range(0, 10, 3)
[0, 3, 6, 9]
>>> range(-10, -100, -30)
[-10, -40, -70]

And D would be:
to!range(5, 10);
to!range(5, 10, 3);
to!range(-1, -100, -30);

But abusing the range word might be bad. I dunno..