Re: Stupid little iota of an idea

2011-02-08 Thread Peter Alexander

On 9/02/11 3:08 AM, Nick Sabalausky wrote:

AUIU, foreach has both of these forms:

 foreach(x; 0..5)
 foreach(x; someRange)

Also, we have:

 auto someRange = iota(0, 5);


Pardon if this has already been suggested.


I have suggested it in the past, and I believe people had suggested it 
before me. I agree, it does make perfect sense to add that syntax, 
although it probably shouldn't be tied into Phobos (maybe add a druntime 
version of iota?)


Re: Stupid little iota of an idea

2011-02-09 Thread bearophile
Nick Sabalausky:

> AUIU, foreach has both of these forms:

D is currently very not-orthogonal.

I have added the enhancement request time ago:
http://d.puremagic.com/issues/show_bug.cgi?id=5395
http://d.puremagic.com/issues/show_bug.cgi?id=4112

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-09 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article
> D is currently very not-orthogonal.

I think you might the person to ask this:
I've seen the concept of orthogonality pop up more and more and it was 
especially
prominent in the awkward Go vs D reddit discussion, can you maybe explain what 
it
exactly means?
And, also how it relates to your enhancement?

> I have added the enhancement request time ago:
> http://d.puremagic.com/issues/show_bug.cgi?id=5395
> http://d.puremagic.com/issues/show_bug.cgi?id=4112
> Bye,
> bearophile




Re: Stupid little iota of an idea

2011-02-09 Thread bearophile
%u:

> can you maybe explain what it exactly means?
> And, also how it relates to your enhancement?

In programming languages it means features that have fully separated purposes, 
that can be combined together in clean and safe ways to create more complex 
functionalities. Combining in "clean and safe ways" means they don't have 
unwanted interactions, their lower level nature is sufficiently encapsulated 
and doesn't leak out too much, so their sub-systems are mostly sealed, if you 
want to see it with systems theory ideas.

In the current discussion foreach(i;iota(5)) and foreach(i;0..5) are usable for 
the same purpose, so those two "features" don't have fully separated purposes. 
On the other hand you can't use 0..5 where you want a lazy range:
auto r = 0 .. 5;
You need to us iota:
auto r = iota(0, 5);
So the 0..5 can't be combined to many other language functionalities to produce 
something bigger.
This is why several people have asked for a more orthogonal interval syntax in 
D.

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-09 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article
> %u:
> > can you maybe explain what it exactly means?
> > And, also how it relates to your enhancement?
> In programming languages it means features that have fully separated purposes,
that can be combined together in clean and safe ways to create more complex
functionalities. Combining in "clean and safe ways" means they don't have 
unwanted
interactions, their lower level nature is sufficiently encapsulated and doesn't
leak out too much, so their sub-systems are mostly sealed, if you want to see it
with systems theory ideas.
> In the current discussion foreach(i;iota(5)) and foreach(i;0..5) are usable 
> for
the same purpose, so those two "features" don't have fully separated purposes. 
On
the other hand you can't use 0..5 where you want a lazy range:
> auto r = 0 .. 5;
> You need to us iota:
> auto r = iota(0, 5);
> So the 0..5 can't be combined to many other language functionalities to 
> produce
something bigger.
> This is why several people have asked for a more orthogonal interval syntax 
> in D.
> Bye,
> bearophile

Thanks!!

int[3] arr = [0..5:2];


Re: Stupid little iota of an idea

2011-02-09 Thread spir

On 02/09/2011 04:08 AM, Nick Sabalausky wrote:

AUIU, foreach has both of these forms:

 foreach(x; 0..5)
 foreach(x; someRange)

Also, we have:

 auto someRange = iota(0, 5);

Little idea: How about this genralized lowering?

 0..5
 // iota says "Gimme some sugar, baby."
 // and thus it is lowered to ->
 iota(0, 5)

Of course, if that hinders optimization for foreach(x; 0..5), then the
compiler could just "optimize" that particular case by not bothering with
the lowering and doing as it currently does.

But the benefit is things like this:

 // Stealing Andrei's "filter even" example:
 filter!`a % 2 == 0`(iota(1, 5))
 // Give iota some sugar, baby:
 filter!`a % 2 == 0`(1..5)

I suppose the obnoxious float-literal definition could get in the way, but
when is it ever legal syntax in D to have two numeric literals next to each
other? (And foreach seems ok with it anyway)

Pardon if this has already been suggested.


I like this. Maybe a slightly different approach would be for both 1..5 and 
iota(1,5) to be expressions for a simple and range-semantic-compatible 
struct-like thingy. Then, actually, iota would be superfluous, but some may 
still like it syntactically or semantically (because Iota is explicitely 
defined as a range type).
Side-question: what is actually 1..5 as of now for a thing? Or is it 
conceptually "unconstructed" by rewriting to (probably) an ordinary for loop? 
Anyway, the point above applies to language-side semantics, whatever 
optimisation may happen.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-09 Thread spir

On 02/09/2011 04:08 AM, Nick Sabalausky wrote:

AUIU, foreach has both of these forms:

 foreach(x; 0..5)
 foreach(x; someRange)

Also, we have:

 auto someRange = iota(0, 5);

Little idea: How about this genralized lowering?

 0..5
 // iota says "Gimme some sugar, baby."
 // and thus it is lowered to ->
 iota(0, 5)

Of course, if that hinders optimization for foreach(x; 0..5), then the
compiler could just "optimize" that particular case by not bothering with
the lowering and doing as it currently does.

But the benefit is things like this:

 // Stealing Andrei's "filter even" example:
 filter!`a % 2 == 0`(iota(1, 5))
 // Give iota some sugar, baby:
 filter!`a % 2 == 0`(1..5)

I suppose the obnoxious float-literal definition could get in the way, but
when is it ever legal syntax in D to have two numeric literals next to each
other? (And foreach seems ok with it anyway)

Pardon if this has already been suggested.


PS: your proposal would also logically allow, I guess, expressions like (n in 
min..max). Would love it.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-09 Thread Nick Sabalausky
"spir"  wrote in message 
news:mailman.1422.1297254724.4748.digitalmar...@puremagic.com...
>
> Side-question: what is actually 1..5 as of now for a thing? Or is it 
> conceptually "unconstructed" by rewriting to (probably) an ordinary for 
> loop? Anyway, the point above applies to language-side semantics, whatever 
> optimisation may happen.
>

AIUI: Syntactically, it doesn't exist at all, at least not by itself. It's 
just part of one of the foreach syntaxes:

  'foreach' '(' {declaration list} ';' {expression} '..' {expression} ')'

and also part of one of the slice syntaxes:

  (from the docs:)
  PostfixExpression [ AssignExpression .. AssignExpression ]

Although it's possible I've understood it wrong.

Don't have a clue how it's handled beyond that though.




Re: Stupid little iota of an idea

2011-02-09 Thread Nick Sabalausky
"spir"  wrote in message 
news:mailman.1423.1297254917.4748.digitalmar...@puremagic.com...
>
> PS: your proposal would also logically allow, I guess, expressions like (n 
> in min..max). Would love it.
>

Unfortunately, not unless "in" was changed to allow "{expr} in {range}". And 
from prior discussions of "in", I seem to remember Walter and Andrei are 
strongly against allowing "in" to be used to check for element values rather 
than just AA keys.

But Andrei did recently propose an "any", IIRC, that would allow something 
like what you're suggesting.




Re: Stupid little iota of an idea

2011-02-09 Thread Andrei Alexandrescu

On 2/9/11 7:54 AM, Nick Sabalausky wrote:

"spir"  wrote in message
news:mailman.1423.1297254917.4748.digitalmar...@puremagic.com...


PS: your proposal would also logically allow, I guess, expressions like (n
in min..max). Would love it.



Unfortunately, not unless "in" was changed to allow "{expr} in {range}". And
from prior discussions of "in", I seem to remember Walter and Andrei are
strongly against allowing "in" to be used to check for element values rather
than just AA keys.

But Andrei did recently propose an "any", IIRC, that would allow something
like what you're suggesting.


a in iota(min, max) is a O(1) operation so it could be allowed.

Andrei



Re: Stupid little iota of an idea

2011-02-09 Thread Andrei Alexandrescu

On 2/9/11 7:46 AM, Nick Sabalausky wrote:

"spir"  wrote in message
news:mailman.1422.1297254724.4748.digitalmar...@puremagic.com...


Side-question: what is actually 1..5 as of now for a thing? Or is it
conceptually "unconstructed" by rewriting to (probably) an ordinary for
loop? Anyway, the point above applies to language-side semantics, whatever
optimisation may happen.



AIUI: Syntactically, it doesn't exist at all, at least not by itself. It's
just part of one of the foreach syntaxes:

   'foreach' '(' {declaration list} ';' {expression} '..' {expression} ')'

and also part of one of the slice syntaxes:

   (from the docs:)
   PostfixExpression [ AssignExpression .. AssignExpression ]

Although it's possible I've understood it wrong.

Don't have a clue how it's handled beyond that though.


Indeed, a..b is just punctuation in the two grammatical constructs you 
mentioned.


Your proposal has indeed been made a couple of times, first probably by 
bearophile - but then what did bearophile /not/ propose? (Meaning this 
in good fun.) I think it would be okay to move iota into druntime and 
enact the rewrite. But this would improve the language by such a small 
iota...


I buy the orthogonality argument as much as you do. foreach is not 
orthogonal because it is a short form of for, which is not orthogonal 
because it is a short form of while, which is not orthogonal because it 
is a short form of a scope with if/goto at the top.


If a..b would be rewritten into iota(a, b) that would still be 
non-orthogonal because one could express one thing in two ways. 
Ironically, it's more orthogonal to leave things as they are: you have 
iota(a, b) as the general concept and you have a..b as punctuation in 
two grammatical constructs.


But the most important question is: if the rewrite were done, to what 
extent would that improve your use of the language? Integral intervals 
do occur outside foreach and slices, but quite infrequently. In those 
cases you'd gain by replacing iota(a, b) with a..b. Is this significant?



Andrei


Re: Stupid little iota of an idea

2011-02-09 Thread spir

On 02/09/2011 01:54 PM, Nick Sabalausky wrote:

"spir"  wrote in message
news:mailman.1423.1297254917.4748.digitalmar...@puremagic.com...


PS: your proposal would also logically allow, I guess, expressions like (n
in min..max). Would love it.



Unfortunately, not unless "in" was changed to allow "{expr} in {range}". And
from prior discussions of "in", I seem to remember Walter and Andrei are
strongly against allowing "in" to be used to check for element values rather
than just AA keys.

But Andrei did recently propose an "any", IIRC, that would allow something
like what you're suggesting.


IIRC, they did not argue against it for ranges specifically, but for it beeing 
O(n) for conceptually sequential collections like plain arrays, unlike for AAs, 
thus misleading in terms of efficiency. But 'in' is O(1) for an interval ;-) 
So, there is no reason to disallow it, instead such a feature would be both 
obvious & useful.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-09 Thread bearophile
Andrei:

> But the most important question is: if the rewrite were done, to what extent 
> would that improve your use of the language? Integral intervals do occur 
> outside foreach and slices, but quite infrequently. In those cases you'd gain 
> by replacing iota(a, b) with a..b. Is this significant?<

I can list you why I think an interval syntax is better, but at the end you 
need to judge values:

- The basic range syntax is already present in two different situations in the 
language, for slices and foreach (switch-case statement use the dot-dot syntax 
for a related but different purpose). So D programmers don't need to learn a 
new syntax, the cognitive cost is probably negative.

- The 1 .. 5 syntax is present in math too (even if it often means a set closed 
on the right too).

- 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.

- Both 1..5 and iota(1,5) are able to support the "in" operator. This is good 
because D doesn't support the ahttp://d.puremagic.com/issues/show_bug.cgi?id=4603


I like the interval literal syntax for static things too, example:
http://d.puremagic.com/issues/show_bug.cgi?id=4085
static foreach (x; 1 .. -5)

A first class literal syntax in D (typeid(typeof(1..5)) gives a new type) may 
become useful for slices too in objects/structs, this is Python 2.6 code:


class Foo(object):
def __getitem__(self, key):
print key
f = Foo()
f[1:2]


Output:
slice(1, 2, None)

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-09 Thread Daniel Gibson
Am 09.02.2011 19:54, schrieb bearophile:
> 
> - Both 1..5 and iota(1,5) are able to support the "in" operator. This is good 
> because D doesn't support the a a<=X 

Don't know about Python, but in D this will only be true if X is an integer.
I guess 11 && X<4, but... I don't
think it's a good idea.
If this syntax is accepted, 1..4 should create a range/array containing [1,2,3]
- without addidional voodoo.

> - If the compiler front-end becomes aware of the interval syntax, it is able 
> to perform "3 in 1..10" at compile-time too, simplifying sub-expressions even 
> when they are inside other run-time expressions.
> 


Cheers,
- Daniel


Re: Stupid little iota of an idea

2011-02-09 Thread Jesse Phillips
%u Wrote:

> == Quote from bearophile (bearophileh...@lycos.com)'s article
> > D is currently very not-orthogonal.
> 
> I think you might the person to ask this:
> I've seen the concept of orthogonality pop up more and more and it was 
> especially
> prominent in the awkward Go vs D reddit discussion, can you maybe explain 
> what it
> exactly means?
> And, also how it relates to your enhancement?

Orthogonal is one of those terms people like to use because it makes them sound 
smart. Bearophile has provided a good explanation of how it relates to 
programming languages, and hasn't been abusing the term.

The discussion on Reddit was awkward because there where a few that couldn't 
consistently use 'orthogonal.' For example I got one person to say that for him 
orthogonality is when there are no exceptions to a rule/feature, yet somehow 
nested functions where not orthogonal.

Then even once everyone agrees on what the term means, there are good arguments 
as to why you wouldn't want to be completely orthogonal. And at this point many 
will just assert not being orthogonal is always bad, with the universal reason 
being "It is something more you have to remember." Which is not the purpose of 
orthogonality at all, and being orthogonal doesn't even mean you'll have less 
to remember.

So my opinion is to just make a statement of what is wrong and leave whether it 
is related to orthogonality out of it. And even if it is labeled correctly it 
best to be specific anyway so people aren't left guessing as to why.


Re: Stupid little iota of an idea

2011-02-09 Thread bearophile
Daniel Gibson:

> Don't know about Python, but in D this will only be true if X is an integer.
> I guess 1 for X
> in 1..4 in D.

You are right, the semantics is different, my silly mistake. Thank you.


> Also using X in 1..4 is in D is pretty bad if you just want to check if 1 (or even more when checking 1 even though it may be technically O(1) because 4 or 100 is a constant)

Even if the bounds are not constants it's not hard to perform  x in a..b  in 
O(1).

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-09 Thread Daniel Gibson
Am 09.02.2011 20:57, schrieb bearophile:
> Daniel Gibson:
> 
>> Don't know about Python, but in D this will only be true if X is an integer.
>> I guess 1> for X
>> in 1..4 in D.
> 
> You are right, the semantics is different, my silly mistake. Thank you.
> 
> 
>> Also using X in 1..4 is in D is pretty bad if you just want to check if 1> (or even more when checking 1> even though it may be technically O(1) because 4 or 100 is a constant)
> 
> Even if the bounds are not constants it's not hard to perform  x in a..b  in 
> O(1).
> 

If the compiler does optimizations (=> transforms it to if( a<=x && x Bye,
> bearophile

Cheers,
- Daniel


Re: Stupid little iota of an idea

2011-02-09 Thread 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)


Re: Stupid little iota of an idea

2011-02-09 Thread Daniel Gibson
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


Re: Stupid little iota of an idea

2011-02-09 Thread Jérôme M. Berger
Ary Manzana wrote:
> 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.
> 
Well, at least “retro” is compatible with the dictionary
signification of the word, so even though it is not the first word
that would come to mind when searching how to reverse a list, it
should be pretty self explanatory when reading existing code.

OTOH, “iota” is not and could even be argued to be antonymous to
the dictionary meaning, which makes it all that much more difficult
to understand.

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



signature.asc
Description: OpenPGP digital signature


Re: Stupid little iota of an idea

2011-02-09 Thread Olivier Pisano

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.
FWIW, what comes to my mind when I read it is an idea of tininess, such 
as in the expression : "It didn't change an iota". I certainly miss the 
mathematical reference.
Retro is self explanatory when you read it, even if it is not the first 
to come to mind. Backwards may have been better. Reverse is already in 
std.algorithm and would have confused the user.


Cheers,

Olivier.


Re: Stupid little iota of an idea

2011-02-09 Thread Lars T. Kyllingstad
On Wed, 09 Feb 2011 17:08:10 -0300, Ary Manzana wrote:

> 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). 

I believe 'iota' got its name from its sibling in C++'s STL:

http://www.sgi.com/tech/stl/iota.html

-Lars


Re: Stupid little iota of an idea

2011-02-10 Thread spir

On 02/09/2011 08:06 PM, Daniel Gibson wrote:

Also using X in 1..4 is in D is pretty bad if you just want to check if 1

I don't understand your point, here. opIn (or rather opIn_r) ids just 2 
comparisons as well for whatever represents an interval i..j. Simulation below.


Denis

struct Interval {
int min, maxPlusOne;
bool opIn_r (int n) {
return (n >= min) && (n < maxPlusOne);
}
}
unittest {
auto ii = Interval(1,4);
auto ints = [-1,0,1,2,3,4,5];
foreach (i ; ints) writefln ("%s ? %s", i, i in ii);
}
==>
-1 ? false
0 ? false
1 ? true
2 ? true
3 ? true
4 ? false
5 ? false

--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread spir

On 02/09/2011 09:08 PM, Ary Manzana wrote:

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.


I completely share your points, here.
About iota, while I cannot speak for the English language, in mine (Fr) iota 
means more or less , typically used as "it 
hasn't (even) changed a iota". I can hardly make any connexion with the sense 
of range/interval. No idea why APL designers used this name, but for sure we 
should not reproduce their error.
Retro is far less problematic because at least the sense matches ;-) But I 
agree an unexpected name is a drawback even if semantically correct: I just 
spent some time searching for "reverse" precisely; I knew they func exists but...


The problems is worse in Phobos, because functionality is split across 
moduleaccording to a non-obvious scheme (if any) (?). In any other language, 
searching for a func operating of foos, you'd just explore the foo module, 
right? In Phobos, you need to explore foo, functional, algorithm, bar & baz, 
and whatnot. Plus possibly some modules outside std properly speaking (core, C 
libs). Very annoying. The logic should be obvious, and at best what most 
programmers would expect.



(and no, replies like "you can always alias xxx" are not accepted :-P)


Certainly, because it's /highly/ important for a community of programmers to 
share the same "culture". And names are the main support & vehicle for this 
culture.


Denis

(For this reason, I stoppped aliasing size_t and size_diff_t to Ordinal and 
Cardinal ;-) I use uint everywhere)


--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread spir

On 02/09/2011 09:09 PM, 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.


Use "Interval". Actually better than range, because it's an international word 
(thus far easier for non-native English speakers). English very often provides 
2 words (typically one is germanic, the other imported); choose the 
international one when none is obviously better.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread spir

On 02/10/2011 07: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.
FWIW, what comes to my mind when I read it is an idea of tininess, such as in
the expression : "It didn't change an iota". I certainly miss the mathematical
reference.


What math sense. Maybe iota used for other meanings in english speaking math 
(would be surprised). I only know 2 uses: an alternative for imaginary 'i' or 
'j', and the module of length 1 along X-axis.
The latter obviously has some connexion with the notion of range, but it 
conflicts in fact, in that iota means a /single/ unit step, and range firstly 
denotes a series of values, not of steps/offsets between them.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread spir

On 02/09/2011 08:20 PM, Jesse Phillips wrote:

%u Wrote:


== Quote from bearophile (bearophileh...@lycos.com)'s article

D is currently very not-orthogonal.


I think you might the person to ask this:
I've seen the concept of orthogonality pop up more and more and it was 
especially
prominent in the awkward Go vs D reddit discussion, can you maybe explain what 
it
exactly means?
And, also how it relates to your enhancement?


Orthogonal is one of those terms people like to use because it makes them sound 
smart. Bearophile has provided a good explanation of how it relates to 
programming languages, and hasn't been abusing the term.

The discussion on Reddit was awkward because there where a few that couldn't 
consistently use 'orthogonal.' For example I got one person to say that for him 
orthogonality is when there are no exceptions to a rule/feature, yet somehow 
nested functions where not orthogonal.

Then even once everyone agrees on what the term means, there are good arguments as to why 
you wouldn't want to be completely orthogonal. And at this point many will just assert 
not being orthogonal is always bad, with the universal reason being "It is something 
more you have to remember." Which is not the purpose of orthogonality at all, and 
being orthogonal doesn't even mean you'll have less to remember.

So my opinion is to just make a statement of what is wrong and leave whether it 
is related to orthogonality out of it. And even if it is labeled correctly it 
best to be specific anyway so people aren't left guessing as to why.


"othogonal" is just a fashionable way of saing "independant.
See acception & example #4 below, from en.wiktionary:

Adjective

orthogonal (non-comparable)

   1. (geometry) pertaining to right angles; perpendicular (to)

  A chord and the radius that bisects it are orthogonal.

   2. (mathematics)
 1. Of two functions, linearly independent; having a zero inner product.

The normal vector and tangent vector at a given point are 
orthogonal.


 2. Of a square matrix that is the inverse of its transpose
 3. Of a linear transformation that preserves angles
   3. (statistics) statistically independent, with reference to variates
   4. (software engineering) Able to be treated separately.

  The content of the message should be orthogonal to the means of its 
delivery.



Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread Andrei Alexandrescu

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


Re: Stupid little iota of an idea

2011-02-10 Thread Max Samukha

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.


Re: Stupid little iota of an idea

2011-02-10 Thread spir

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
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?


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread Ary Manzana

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


Re: Stupid little iota of an idea

2011-02-10 Thread Jacob Carlborg

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


Re: Stupid little iota of an idea

2011-02-10 Thread Jérôme M. Berger
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:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


Re: Stupid little iota of an idea

2011-02-10 Thread Andrei Alexandrescu

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


Re: Stupid little iota of an idea

2011-02-10 Thread Andrei Alexandrescu

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 
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: 
References: 
 
 
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: use...@digitalmars.com
NNTP-Posting-Date: Thu, 15 Jul 2004 00:27:03 + (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
 wrote:

"Sean Kelly"  wrote in message
news:cd4dqj$m1f$1...@digitaldaemon.com...

In article , 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

Re: Stupid little iota of an idea

2011-02-10 Thread Jesse Phillips
spir Wrote:

> Use "Interval". Actually better than range, because it's an international 
> word 
> (thus far easier for non-native English speakers). English very often 
> provides 
> 2 words (typically one is germanic, the other imported); choose the 
> international one when none is obviously better.

I would have thought that Greek/Latin would have been a more "International 
Word"


Re: Stupid little iota of an idea

2011-02-10 Thread Sean Kelly
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?


Re: Stupid little iota of an idea

2011-02-10 Thread spir

On 02/10/2011 11:50 PM, Jesse Phillips wrote:

spir Wrote:


Use "Interval". Actually better than range, because it's an international word
(thus far easier for non-native English speakers). English very often provides
2 words (typically one is germanic, the other imported); choose the
international one when none is obviously better.


I would have thought that Greek/Latin would have been a more "International 
Word"


That's what I meant, but obviously was not clear. (Yes, very often 
international words means of greek/latin origin but there are numerous 
counter-examples in both senses; I mean greco-latin roots which have not been 
adopted in "international lexicon" --like range, precisely--, and international 
terms from other origins --like 'bug" ;-). ()


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-10 Thread Nick Sabalausky
"Max Samukha"  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?).





Re: Stupid little iota of an idea

2011-02-10 Thread Nick Sabalausky
"Andrei Alexandrescu"  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". 




Re: Stupid little iota of an idea

2011-02-10 Thread Jonathan M Davis
On Thursday, February 10, 2011 17:45:21 Nick Sabalausky wrote:
> "Andrei Alexandrescu"  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


Re: Stupid little iota of an idea

2011-02-10 Thread Andrej Mitrovic
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..


Re: Stupid little iota of an idea

2011-02-10 Thread so
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!


Re: Stupid little iota of an idea

2011-02-10 Thread Andrej Mitrovic
What the hell does "to!" have to do with anything. Disregard my last
post, it's obviously 3 AM and I'm talking gibberish.

In any case,
alias iota range;

Problem solved for me!


Re: Stupid little iota of an idea

2011-02-10 Thread Nick Sabalausky
"Andrej Mitrovic"  wrote in message 
news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...
> What the hell does "to!" have to do with anything. Disregard my last
> post, it's obviously 3 AM and I'm talking gibberish.
>

I just meant that "iota" looks a lot like (spaces added for clarity) "i   to 
a". In other words, the first time I ever saw "iota", I confused it for the 
old C function that converts an integer to an ASCII string. It may very well 
have been 3am for me at the time ;)




Re: Stupid little iota of an idea

2011-02-10 Thread Andrej Mitrovic
On 2/11/11, Nick Sabalausky  wrote:
> "Andrej Mitrovic"  wrote in message
> news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...
>> What the hell does "to!" have to do with anything. Disregard my last
>> post, it's obviously 3 AM and I'm talking gibberish.
>>
>
> I just meant that "iota" looks a lot like (spaces added for clarity) "i   to
> a". In other words, the first time I ever saw "iota", I confused it for the
> old C function that converts an integer to an ASCII string. It may very well
> have been 3am for me at the time ;)
>

Oh, sorry if it appeared I quoted you, but I wasn't quoting you I was
quoting myself and my silly to!range thingy.

I still don't even know what iota stands for. Is it an abbreviation?
It sounds like a word that came out of nowhere.


Re: Stupid little iota of an idea

2011-02-10 Thread Nick Sabalausky
"Andrej Mitrovic"  wrote in message 
news:mailman.1477.1297394949.4748.digitalmar...@puremagic.com...
> On 2/11/11, Nick Sabalausky  wrote:
>> "Andrej Mitrovic"  wrote in message
>> news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...
>>> What the hell does "to!" have to do with anything. Disregard my last
>>> post, it's obviously 3 AM and I'm talking gibberish.
>>>
>>
>> I just meant that "iota" looks a lot like (spaces added for clarity) "i 
>> to
>> a". In other words, the first time I ever saw "iota", I confused it for 
>> the
>> old C function that converts an integer to an ASCII string. It may very 
>> well
>> have been 3am for me at the time ;)
>>
>
> Oh, sorry if it appeared I quoted you, but I wasn't quoting you I was
> quoting myself and my silly to!range thingy.
>

Apperently you're not the only one that's tired and talking gibberish ;)




Re: Stupid little iota of an idea

2011-02-11 Thread Jacob Carlborg

On 2011-02-11 04:15, Nick Sabalausky wrote:

"Andrej Mitrovic"  wrote in message
news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...

What the hell does "to!" have to do with anything. Disregard my last
post, it's obviously 3 AM and I'm talking gibberish.



I just meant that "iota" looks a lot like (spaces added for clarity) "i   to
a". In other words, the first time I ever saw "iota", I confused it for the
old C function that converts an integer to an ASCII string. It may very well
have been 3am for me at the time ;)


I thought that as well that first time I saw it.

--
/Jacob Carlborg


Re: Stupid little iota of an idea

2011-02-11 Thread Jacob Carlborg

On 2011-02-10 23:05, Andrei Alexandrescu wrote:

On 2/10/11 9:47 AM, spir wrote:

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


Of course you don't think it's stupid, you named it. It starts to look 
more and more that you are the only one that likes it. How about we vote 
about it ?


--
/Jacob Carlborg


Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/11/2011 03:06 AM, Jonathan M Davis wrote:

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?)


why not "interval"? (not obvious enough ;-)

denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/11/2011 02:38 AM, Nick Sabalausky wrote:

"Max Samukha"  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.


Result #38 for me.

Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread foobar
Andrei Alexandrescu Wrote:

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

Of course _you_ don't. However practically all the users _do_ find it poorly 
named, including other developers in the project.. 
This is the umpteenth time this comes up in the NG and incidentally this is the 
only reason I know what the function does. 

If the users think the name is stupid than it really is. That's how usability 
works and the fact the you think otherwise or that it might be more accurate 
mathematically is really not relevant. If you want D/Phobos to be used by other 
people besides yourself you need to cater for their requirements. 



Re: Stupid little iota of an idea

2011-02-11 Thread Ary Manzana

On 2/11/11 12:15 AM, Nick Sabalausky wrote:

"Andrej Mitrovic"  wrote in message
news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...

What the hell does "to!" have to do with anything. Disregard my last
post, it's obviously 3 AM and I'm talking gibberish.



I just meant that "iota" looks a lot like (spaces added for clarity) "i   to
a". In other words, the first time I ever saw "iota", I confused it for the
old C function that converts an integer to an ASCII string. It may very well
have been 3am for me at the time ;)


You are the second one who confuses iota with itoa. Actually, the third, 
I confused it too.


According to the book "The Design of Everyday Things" the design of that 
function name is wrong, it's not your fault and it's not because it was 
3am. When many people make mistakes with regards to the design of 
something it's *always* the design's fault, never the human's fault.




Re: Stupid little iota of an idea

2011-02-11 Thread Steven Schveighoffer
On Fri, 11 Feb 2011 09:06:06 -0500, Ary Manzana   
wrote:



On 2/11/11 12:15 AM, Nick Sabalausky wrote:

"Andrej Mitrovic"  wrote in message
news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...

What the hell does "to!" have to do with anything. Disregard my last
post, it's obviously 3 AM and I'm talking gibberish.



I just meant that "iota" looks a lot like (spaces added for clarity)  
"i   to
a". In other words, the first time I ever saw "iota", I confused it for  
the
old C function that converts an integer to an ASCII string. It may very  
well

have been 3am for me at the time ;)


You are the second one who confuses iota with itoa. Actually, the third,  
I confused it too.


According to the book "The Design of Everyday Things" the design of that  
function name is wrong, it's not your fault and it's not because it was  
3am. When many people make mistakes with regards to the design of  
something it's *always* the design's fault, never the human's fault.


Also, C code is callable from D.  consider a seasoned d coder who sees  
code like:


auto x = itoa(5);

what is he going to thing x is?

-Steve


Re: Stupid little iota of an idea

2011-02-11 Thread Steven Schveighoffer
On Fri, 11 Feb 2011 09:06:06 -0500, Ary Manzana   
wrote:



On 2/11/11 12:15 AM, Nick Sabalausky wrote:

"Andrej Mitrovic"  wrote in message
news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...

What the hell does "to!" have to do with anything. Disregard my last
post, it's obviously 3 AM and I'm talking gibberish.



I just meant that "iota" looks a lot like (spaces added for clarity)  
"i   to
a". In other words, the first time I ever saw "iota", I confused it for  
the
old C function that converts an integer to an ASCII string. It may very  
well

have been 3am for me at the time ;)


You are the second one who confuses iota with itoa. Actually, the third,  
I confused it too.


Me 2.

According to the book "The Design of Everyday Things" the design of that  
function name is wrong, it's not your fault and it's not because it was  
3am. When many people make mistakes with regards to the design of  
something it's *always* the design's fault, never the human's fault.


I love that book, I wish more software engineers used it.  One of my  
favorite classes at college.


-Steve


Re: Stupid little iota of an idea

2011-02-11 Thread Daniel Gibson
Am 10.02.2011 12:40, schrieb spir:
> 
> Certainly, because it's /highly/ important for a community of programmers to
> share the same "culture". And names are the main support & vehicle for this
> culture.
> 
> Denis
> 
> (For this reason, I stoppped aliasing size_t and size_diff_t to Ordinal and
> Cardinal ;-) I use uint everywhere)
> 

This will cause trouble on 64bit systems, because there size_t is ulong.

Cheers,
- Daniel


Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/11/2011 03:32 PM, Daniel Gibson wrote:

Am 10.02.2011 12:40, schrieb spir:


Certainly, because it's /highly/ important for a community of programmers to
share the same "culture". And names are the main support&  vehicle for this
culture.

Denis

(For this reason, I stoppped aliasing size_t and size_diff_t to Ordinal and
Cardinal ;-) I use uint everywhere)



This will cause trouble on 64bit systems, because there size_t is ulong.


Yes and No. For pointers and mem diffs, yes. But for 99% uses of cardinals and 
ordinals uint is by far big enough.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread bearophile
spir:

> But for 99% uses of cardinals and ordinals uint is by far big enough.

Then in D2 for those use an int. Unsigned values are _very_ bug-prone in D2.

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-11 Thread Andrei Alexandrescu

On 2/10/11 5:29 PM, Sean Kelly wrote:

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?


Pretty much, with the note that the smallest nondegenerated integral 
step is 1 :o).


The name "iota" makes perfect sense to me, I knew what it does in the 
STL from its signature before reading its definition. There are people 
who don't like it, there are people who do, and there are people who 
simply pick up the name and use it. I don't see how to improve global 
happiness.



Andrei


Re: Stupid little iota of an idea

2011-02-11 Thread Andrei Alexandrescu

On 2/10/11 8:28 PM, Andrej Mitrovic wrote:

What the hell does "to!" have to do with anything. Disregard my last
post, it's obviously 3 AM and I'm talking gibberish.

In any case,
alias iota range;

Problem solved for me!


Aside from the fact that "range" has another meaning in D, the word does 
not convey the notion that iota adds incremental steps to move from one 
number to another. "Iota" does convey that notion.


Andrei


Re: Stupid little iota of an idea

2011-02-11 Thread Andrej Mitrovic
On 2/11/11, Andrei Alexandrescu  wrote:
> On 2/10/11 8:28 PM, Andrej Mitrovic wrote:
>> What the hell does "to!" have to do with anything. Disregard my last
>> post, it's obviously 3 AM and I'm talking gibberish.
>>
>> In any case,
>> alias iota range;
>>
>> Problem solved for me!
>
> Aside from the fact that "range" has another meaning in D, the word does
> not convey the notion that iota adds incremental steps to move from one
> number to another. "Iota" does convey that notion.
>
> Andrei
>

So why does Python use it?

It seems Go uses iota, but for something different:
http://golang.org/doc/go_spec.html#Iota

That's rather ugly imo. But that's Go. :)


Re: Stupid little iota of an idea

2011-02-11 Thread Jim
bearophile Wrote:
> Then in D2 for those use an int. Unsigned values are _very_ bug-prone in D2.

May I ask why?


Re: Stupid little iota of an idea

2011-02-11 Thread bearophile
Jim:

> bearophile Wrote:
> > Then in D2 for those use an int. Unsigned values are _very_ bug-prone in D2.
> 
> May I ask why?

Because:
- D unsigned numbers are fixed-sized bitfields, they overflow. (Multi-precision 
values are not built-in, they are currently slow if you need a 30 or 50 or 70 
bit long value, and generally they feel like grafted on the language).
- There are no run-time overflow errors, as in C#/Delphi/etc (this is 
ridiculous for any language that hopes to make safety one of its strong points. 
Delphi has this feature since ages ago. Not having this in D is like going back 
to 1980 or before. It gives a peculiar stone-age style to the whole D language).
- D copies the weird/bad C signed-unsigned conversion rules, that cause plenty 
of troubles.
- D doesn't have warnings like GCC that give a bit of help against the C 
signed-unsigned conversion rules, nor against things like unsigned<0.

In Delphi using unsigned numbers is safer, but in D it's actually safer to use 
signed values :-)
All this is compound with the design choice of using signed values for arrays 
and indexes in D.

One even less bright design decision was to use unsigned longs for array 
positions, etc:
http://d.puremagic.com/issues/show_bug.cgi?id=5452

Generally in the current D the best advice is to limit the usage of unsigned 
values as much as possible, and use them only in the uncommon situations where 
they are needed, like:
- When you need the full range of 8, 16, 32 or 64 bits. This is uncommon, but 
it happens. Example: you really want to save memory to store indexes and you 
need you will have no more than about 40_000 items. Then use an ushort.
- To store bitfields, like an array of 50_000 bits, to implement a bit set, 
some kind of bitmap, bloom filter, etc.
- When you need to deserialize or receive data from some channel or memory, 
that you know is for example a 32 unsigned int or 16 bit unsigned int, a 
unsigned 8 bit digital signal from some instrument, etc.

In most other cases it's better to use signed values, for example you will 
avoid several bugs if in your code you use lines of code like:
int len = array.length;
and then you use len in the rest of your function.

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-11 Thread bearophile
Andrei:

> Aside from the fact that "range" has another meaning in D, the word does 
> not convey the notion that iota adds incremental steps to move from one 
> number to another. "Iota" does convey that notion.

I have accepted  the "iota" name, it's short, easy to remember, it has one 
historical usage in APL, and "Range" has another meaning in D (but it's weird, 
and it's something you need to learn, it's not something a newbie is supposed 
to know before reading D2 docs well. The name "interval" is better, simpler to 
understand, but it's longer for a so common function).

But this answer of yours is stepping outside the bounds of reasonableness :-) 
If you ask a pool of 20 programmers what range(10,20) or iota(10,20) means, I'm 
sure more people will guess range() correctly than iota(). The word range() do 
convey a complete enumeration of values in an interval. iota() does not convey 
that.

Said all this, I suggest to introduce the first-class a..b interval syntax in D 
(or even a..b:c), this is able to remove most (all?) usage of iota().

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-11 Thread Nick Sabalausky
"Steven Schveighoffer"  wrote in message 
news:op.vqqsdxcaeav7ka@steve-laptop...
>
>> According to the book "The Design of Everyday Things" the design of that 
>> function name is wrong, it's not your fault and it's not because it was 
>> 3am. When many people make mistakes with regards to the design of 
>> something it's *always* the design's fault, never the human's fault.
>
> I love that book, I wish more software engineers used it.  One of my 
> favorite classes at college.
>

I probably would have liked that class if my college hadn't degenerated it 
into nothing more than "group VB6 project". Bleh. I always hated group 
projects.  /me "Does not play well with others."

I really should actually read that book. I've heard a lot about what it 
says, and I like everything I've heard. Even without having read it, it's 
still influenced me a fair amount.





Re: Stupid little iota of an idea

2011-02-11 Thread Nick Sabalausky
"bearophile"  wrote in message 
news:ij473k$1tfn$1...@digitalmars.com...
> Andrei:
>
>> Aside from the fact that "range" has another meaning in D, the word does
>> not convey the notion that iota adds incremental steps to move from one
>> number to another. "Iota" does convey that notion.
>
> I have accepted  the "iota" name, it's short, easy to remember, it has one 
> historical usage in APL, and "Range" has another meaning in D (but it's 
> weird, and it's something you need to learn, it's not something a newbie 
> is supposed to know before reading D2 docs well. The name "interval" is 
> better, simpler to understand, but it's longer for a so common function).
>
> But this answer of yours is stepping outside the bounds of reasonableness 
> :-) If you ask a pool of 20 programmers what range(10,20) or iota(10,20) 
> means, I'm sure more people will guess range() correctly than iota(). The 
> word range() do convey a complete enumeration of values in an interval. 
> iota() does not convey that.
>
> Said all this, I suggest to introduce the first-class a..b interval syntax 
> in D (or even a..b:c), this is able to remove most (all?) usage of iota().
>

I like "interval", too.

I do think the name "iota" is a nice extra reason to just use a..b or a..b:c 
like you say. It also makes it clear that it's a series of discrete values 
rather than a true mathematical range, since that's exactly how foreach 
already uses a..b: as a series of discrete values.





Re: Stupid little iota of an idea

2011-02-11 Thread Steven Schveighoffer

On Fri, 11 Feb 2011 17:03:13 -0500, Nick Sabalausky  wrote:


"Steven Schveighoffer"  wrote in message
news:op.vqqsdxcaeav7ka@steve-laptop...


According to the book "The Design of Everyday Things" the design of  
that

function name is wrong, it's not your fault and it's not because it was
3am. When many people make mistakes with regards to the design of
something it's *always* the design's fault, never the human's fault.


I love that book, I wish more software engineers used it.  One of my
favorite classes at college.



I probably would have liked that class if my college hadn't degenerated  
it

into nothing more than "group VB6 project". Bleh. I always hated group
projects.  /me "Does not play well with others."


From what I can remember, I did not have to write any code in that class.   
I had to pick an item in my household and write a paper on what features  
were well designed and which ones were poor.  I have a feeling you would  
have loved that ;)


-Steve


Re: Stupid little iota of an idea

2011-02-11 Thread bearophile
Nick Sabalausky:

> I really should actually read that book.

Donald Norman is not a genius, he seems to lack both in engineering knowledge 
and classic literary culture, but despite this he has the right mindset to 
explore the world and he does look a lot at the world and its things, so he 
ends saying many interesting things. I suggest to read all books written by him 
:-) 

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-11 Thread Nick Sabalausky
"Steven Schveighoffer"  wrote in message 
news:op.vqrewtcfeav7ka@steve-laptop...
> On Fri, 11 Feb 2011 17:03:13 -0500, Nick Sabalausky  wrote:
>
>> "Steven Schveighoffer"  wrote in message
>> news:op.vqqsdxcaeav7ka@steve-laptop...
>>>
 According to the book "The Design of Everyday Things" the design of 
 that
 function name is wrong, it's not your fault and it's not because it was
 3am. When many people make mistakes with regards to the design of
 something it's *always* the design's fault, never the human's fault.
>>>
>>> I love that book, I wish more software engineers used it.  One of my
>>> favorite classes at college.
>>>
>>
>> I probably would have liked that class if my college hadn't degenerated 
>> it
>> into nothing more than "group VB6 project". Bleh. I always hated group
>> projects.  /me "Does not play well with others."
>
> From what I can remember, I did not have to write any code in that class. 
> I had to pick an item in my household and write a paper on what features 
> were well designed and which ones were poor.  I have a feeling you would 
> have loved that ;)
>

lol, that's a good point, I probably could have had a lot of fun with that 
:)




Re: Stupid little iota of an idea

2011-02-11 Thread Nick Sabalausky
"foobar"  wrote in message news:ij3cal$cee$1...@digitalmars.com...
> Andrei Alexandrescu Wrote:
>
>>
>> I don't find the name "iota" stupid.
>>
>> Andrei
>
> Of course _you_ don't. However practically all the users _do_ find it 
> poorly named, including other developers in the project..
> This is the umpteenth time this comes up in the NG and incidentally this 
> is the only reason I know what the function does.
>
> If the users think the name is stupid than it really is. That's how 
> usability works and the fact the you think otherwise or that it might be 
> more accurate mathematically is really not relevant. If you want D/Phobos 
> to be used by other people besides yourself you need to cater for their 
> requirements.
>

I'd bet that most of the people looking at D's "filtering even numbers" 
example over at ( https://gist.github.com/817504 ) are thinking, "WTF is 
'iota'?"  (Either that or "What the hell is he converting to ASCII for?")




Re: Stupid little iota of an idea

2011-02-11 Thread foobar
Ary Manzana Wrote:

> On 2/11/11 12:15 AM, Nick Sabalausky wrote:
> > "Andrej Mitrovic"  wrote in message
> > news:mailman.1476.1297391467.4748.digitalmar...@puremagic.com...
> >> What the hell does "to!" have to do with anything. Disregard my last
> >> post, it's obviously 3 AM and I'm talking gibberish.
> >>
> >
> > I just meant that "iota" looks a lot like (spaces added for clarity) "i   to
> > a". In other words, the first time I ever saw "iota", I confused it for the
> > old C function that converts an integer to an ASCII string. It may very well
> > have been 3am for me at the time ;)
> 
> You are the second one who confuses iota with itoa. Actually, the third, 
> I confused it too.
> 
> According to the book "The Design of Everyday Things" the design of that 
> function name is wrong, it's not your fault and it's not because it was 
> 3am. When many people make mistakes with regards to the design of 
> something it's *always* the design's fault, never the human's fault.
> 

Thanks for this, I'm adding this book to my read list. :)



Re: Stupid little iota of an idea

2011-02-11 Thread Andrei Alexandrescu

On 2/11/11 2:46 AM, Jacob Carlborg wrote:

On 2011-02-10 23:05, Andrei Alexandrescu wrote:

On 2/10/11 9:47 AM, spir wrote:

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


Of course you don't think it's stupid, you named it. It starts to look
more and more that you are the only one that likes it. How about we vote
about it ?



Sure. Have at it! I'll be glad to comply with the vote.

Andrei


Re: Stupid little iota of an idea

2011-02-11 Thread Andrei Alexandrescu

On 2/11/11 7:07 AM, foobar wrote:

Andrei Alexandrescu Wrote:



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

Andrei


Of course _you_ don't. However practically all the users _do_ find it
poorly named, including other developers in the project.. This is the
umpteenth time this comes up in the NG and incidentally this is the
only reason I know what the function does.

If the users think the name is stupid than it really is. That's how
usability works and the fact the you think otherwise or that it might
be more accurate mathematically is really not relevant. If you want
D/Phobos to be used by other people besides yourself you need to
cater for their requirements.


Not all users dislike iota, and besides arguments ad populum are 
fallacious. Iota rocks. But have at it - vote away, and I'll be glad if 
a better name for iota comes about.


Andrei


Re: Stupid little iota of an idea

2011-02-11 Thread Andrei Alexandrescu

On 2/11/11 8:32 AM, Daniel Gibson wrote:

Am 10.02.2011 12:40, schrieb spir:


Certainly, because it's /highly/ important for a community of programmers to
share the same "culture". And names are the main support&  vehicle for this
culture.

Denis

(For this reason, I stoppped aliasing size_t and size_diff_t to Ordinal and
Cardinal ;-) I use uint everywhere)



This will cause trouble on 64bit systems, because there size_t is ulong.

Cheers,
- Daniel


Yah... big problems on Phobos' 64-bit port.

Andrei


Re: Stupid little iota of an idea

2011-02-11 Thread so
Not all users dislike iota, and besides arguments ad populum are  
fallacious. Iota rocks. But have at it - vote away, and I'll be glad if  
a better name for iota comes about.


Andrei


You asked for it!

atob(1, 6) // easy to mix things like atoi
ptoq(1, 6) // rocks imo!


Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/12/2011 12:55 AM, Andrei Alexandrescu wrote:

Not all users dislike iota, and besides arguments ad populum are fallacious.
Iota rocks. But have at it - vote away, and I'll be glad if a better name for
iota comes about.


Proposed "interval" (which I understand as a quasi-synonym of range, apart from 
D's use of the term). 1-2 more people seemed to find it appropriate. Bearophile 
argued interval is ok but too long for such a common (?)(*) feature. What do 
you think?


Denis

(*) The notion is indeed somewhat common in code, but we have i..j for the most 
common cases, by far. iota() is only for when we need an assignable value 
representing an interval.

--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread so

atob(1, 6) // easy to mix things like atoi
ptoq(1, 6) // rocks imo!


walk(1, 6) // now you have admit this is the best.


Re: Stupid little iota of an idea

2011-02-11 Thread bearophile
Andrei:

> Not all users dislike iota,

A poll will tell how much this statement is true :-)


> and besides arguments ad populum are fallacious.

That's true for scientific and engineering (or medical, etc) things but names 
are not a science. The process of choosing names is part of ergonomics, it must 
deal with what people, with what they find closer to their mind, culture, 
brain. Python developers discuss carefully about naming, and indeed, Python 
names are sometimes better than Phobos ones. One of the problems here is that 
the mind of every person, you, me, Walter's has "quirks", that is mind 
processes not shared by most other people. So if a single person chooses names, 
those quirks come out, and the names are uniform (because they are chosen using 
the same strategy, and this is positive), but sometimes they also reflect those 
quirks. The only way I know to avoid this problem is to design names using 
polls :-)


> Iota rocks. But have at it - vote away, and I'll be glad if 
> a better name for iota comes about.

I am not going to invent a new wonderful name for it, sorry :-) My votes, in 
decreasing order of preference:
1) By far, a syntax like a..b:c, or missing that, a syntax like a..b
2) If first class interval syntax is really not possible, then my second choice 
is a function named "range". This is what Python uses, it's natural, short 
enough, and good.
3) If you refuse the word "range", then my third choice is "interval". It's as 
cleas as range, but it's a bit worse because it's longer.
4) My fourth choice is "iota". It's short and it sticks in mind.

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/12/2011 01:26 AM, so wrote:

Not all users dislike iota, and besides arguments ad populum are fallacious.
Iota rocks. But have at it - vote away, and I'll be glad if a better name for
iota comes about.

Andrei


You asked for it!

atob(1, 6) // easy to mix things like atoi
ptoq(1, 6) // rocks imo!


alias retro!iota atoi;

Actually, I like the term iota very much; would enjoy finding a good use for 
it. Something related to tolerance interval, for instance, like in production 
of mechanical parts. Really fits the notion of "a difference small enough to 
make no difference".


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread Michel Fortin

On 2011-02-11 19:55:05 -0500, bearophile  said:

I am not going to invent a new wonderful name for it, sorry :-) My 
votes, in decreasing order of preference:

1) By far, a syntax like a..b:c, or missing that, a syntax like a..b


No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, 
how do you rewrite this using the new proposed syntax:


auto aa = [iota(a, b, c): 1, iota(d, e): 2];


3) If you refuse the word "range", then my third choice is "interval". 
It's as cleas as range, but it's a bit worse because it's longer.


Interval is clear only as long as there's no step value mentioned. 
Having a step value is quite a stretch from the usual notion of an 
interval.


I like a lot so's suggestion "walk". I'm not sure it's much clearer 
than iota though.


--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/



Re: Stupid little iota of an idea

2011-02-11 Thread Daniel Gibson
Am 12.02.2011 01:46, schrieb so:
>> atob(1, 6) // easy to mix things like atoi
>> ptoq(1, 6) // rocks imo!
> 
> walk(1, 6) // now you have admit this is the best.

Hmm I do kind of like it.


Re: Stupid little iota of an idea

2011-02-11 Thread bearophile
Michel Fortin:

> No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, 
> how do you rewrite this using the new proposed syntax:
> 
>   auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota 
usages. There are some situations where you can't use it well. This is another 
situation I've shown in the enhancement request:
iota(10.,20.)
Writing it like this is not sane:
 10...20.


> Interval is clear only as long as there's no step value mentioned. 
> Having a step value is quite a stretch from the usual notion of an 
> interval.

Right, but I think it's acceptable still, and better than iota.


> I like a lot so's suggestion "walk". I'm not sure it's much clearer 
> than iota though.

It's better than iota, but not by much.

Bye,
bearophile


Re: Stupid little iota of an idea

2011-02-11 Thread Daniel Gibson
Am 12.02.2011 02:25, schrieb bearophile:
> Michel Fortin:
> 
>> No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, 
>> how do you rewrite this using the new proposed syntax:
>>
>>  auto aa = [iota(a, b, c): 1, iota(d, e): 2];
> 
> Right, that's why in another post I have said that syntax replaces most iota 
> usages. There are some situations where you can't use it well. This is 
> another situation I've shown in the enhancement request:
> iota(10.,20.)
> Writing it like this is not sane:
>  10...20.
> 
> 
>> Interval is clear only as long as there's no step value mentioned. 
>> Having a step value is quite a stretch from the usual notion of an 
>> interval.
> 
> Right, but I think it's acceptable still, and better than iota.
> 
> 
>> I like a lot so's suggestion "walk". I'm not sure it's much clearer 
>> than iota though.
> 
> It's better than iota, but not by much.
> 
> Bye,
> bearophile

I think it's much better. Even having "steps" (or a stepsize) is obvious with 
walk.

iota only makes sense when you know this from other languages/libraries or if
your native spoken language has a similar word that can be somehow connected.
http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two
English->German dictionaries I've checked don't either - one only listed iota as
the greek letter, the other had mentions about something tiny) - it's just
something small like that greek i-without-a-dot letter.
There's nothing that connects it to a range of values with a fixed step size.

Cheers,
- Daniel


Re: Stupid little iota of an idea

2011-02-11 Thread Walter Bright

Andrei Alexandrescu wrote:
Not all users dislike iota, and besides arguments ad populum are 
fallacious. Iota rocks. But have at it - vote away, and I'll be glad if 
a better name for iota comes about.



delta


Re: Stupid little iota of an idea

2011-02-11 Thread Walter Bright

foobar wrote:

Ary Manzana Wrote:
According to the book "The Design of Everyday Things" the design of that 
function name is wrong, it's not your fault and it's not because it was 
3am. When many people make mistakes with regards to the design of 
something it's *always* the design's fault, never the human's fault.




Thanks for this, I'm adding this book to my read list. :)



Every engineer and designer should read it. It's a classic, and a quick read.

The irony of it is, of course, everyone agrees with it, laughs at the stupid 
designs shown in the book, and then goes right out and create their own equally 
stupid designs.


Making designs that are intuitively obvious is amazingly difficult.


Re: Stupid little iota of an idea

2011-02-11 Thread Andrej Mitrovic
On 2/12/11, Walter Bright  wrote:
> Andrei Alexandrescu wrote:
>> Not all users dislike iota, and besides arguments ad populum are
>> fallacious. Iota rocks. But have at it - vote away, and I'll be glad if
>> a better name for iota comes about.
>
>
> delta
>

Now that's sexy. Makes me feel like a commander when coding D.

In fact, let me dust off my old C&C cd's, I'm in the mood for some RTS.


Re: Stupid little iota of an idea

2011-02-11 Thread Jonathan M Davis
On Friday, February 11, 2011 17:02:18 Michel Fortin wrote:
> On 2011-02-11 19:55:05 -0500, bearophile  said:
> > I am not going to invent a new wonderful name for it, sorry :-) My
> > votes, in decreasing order of preference:
> > 1) By far, a syntax like a..b:c, or missing that, a syntax like a..b
> 
> No one noticed yet that the a..b:c syntax causes ambiguity? Tell me,
> how do you rewrite this using the new proposed syntax:
> 
>   auto aa = [iota(a, b, c): 1, iota(d, e): 2];
> 
> > 3) If you refuse the word "range", then my third choice is "interval".
> > It's as cleas as range, but it's a bit worse because it's longer.
> 
> Interval is clear only as long as there's no step value mentioned.
> Having a step value is quite a stretch from the usual notion of an
> interval.
> 
> I like a lot so's suggestion "walk". I'm not sure it's much clearer
> than iota though.

Honestly, I'd prefer iota to walk or interval. I see walk and I think about 
walkLength. It certainly isn't enough to tell me what the function does. 
interval is slightly better, but as you mention, the step value muddles that 
abstraction. While iota isn't clear, it _does_ have the advantage that you're 
not going to _mis_understand what it does based on its name, and it is _highly_ 
memorable. It's also short, which is nice. genSequence is pretty much the only 
thing that I've been able to think of that I like at all, but I'm perfectly 
fine 
with keeping iota, honestly. It's short, and I'll actually remember it, even if 
I don't use it all of the time.

The thing about this kind of voting though is that it's likely that all of the 
folks who dislike the status quo will comment/complain and vote, whereas the 
people who don't really care or who actually really like the status quo mostly 
probably already stop reading this thread and won't say anything. So, it will 
look like the consensus is that the status quo is bad even if the majority 
actually don't agree. So, if we want to actually vote on this, then we should 
come up with a set of suggestions for the name and then start a new thread vote 
the vote. Personally, I'd just as soon leave iota as-is.

- Jonathan M Davis


Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/12/2011 01:46 AM, so wrote:

atob(1, 6) // easy to mix things like atoi
ptoq(1, 6) // rocks imo!


walk(1, 6) // now you have admit this is the best.


Not bad, after all walk is a series of steps ;-)

Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/12/2011 01:55 AM, bearophile wrote:

4) My fourth choice is "iota". It's short and it sticks in mind.


'Ψ' "psi" (beeing the forelast letter of the alphabet, just before omega, as 
everyone knows) would nicely suggest we're dealing with intervals half-open on 
the right-hand side.


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/12/2011 02:36 AM, Daniel Gibson wrote:

Am 12.02.2011 02:25, schrieb bearophile:

Michel Fortin:


No one noticed yet that the a..b:c syntax causes ambiguity? Tell me,
how do you rewrite this using the new proposed syntax:

auto aa = [iota(a, b, c): 1, iota(d, e): 2];


Right, that's why in another post I have said that syntax replaces most iota 
usages. There are some situations where you can't use it well. This is another 
situation I've shown in the enhancement request:
iota(10.,20.)
Writing it like this is not sane:
  10...20.



Interval is clear only as long as there's no step value mentioned.
Having a step value is quite a stretch from the usual notion of an
interval.


Right, but I think it's acceptable still, and better than iota.



I like a lot so's suggestion "walk". I'm not sure it's much clearer
than iota though.


It's better than iota, but not by much.

Bye,
bearophile


I think it's much better. Even having "steps" (or a stepsize) is obvious with 
walk.

iota only makes sense when you know this from other languages/libraries or if
your native spoken language has a similar word that can be somehow connected.
http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two
English->German dictionaries I've checked don't either - one only listed iota as
the greek letter, the other had mentions about something tiny) - it's just
something small like that greek i-without-a-dot letter.
There's nothing that connects it to a range of values with a fixed step size.


That page looks listing various meanings in foreign languages, but mostly 
stincks with the greek letter; it does not mention any sense everday sense iota 
actually has. Example fro fr.wiktionary:


# Nom de ι, Ι, neuvième lettre et quatrième voyelle de l’alphabet grec. 
Équivalent du i latin.

# Petite quantité négligeable, presque rien.

Free translation: little negligible quantity, nearly nothing.
There are good chances iota has a similar meaning in numerous languages, 
especially romance ones. Bearophile, Andrei?


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread spir

On 02/12/2011 03:05 AM, Jonathan M Davis wrote:

While iota isn't clear, it _does_ have the advantage that you're
not going to _mis_understand


Maybe you say this because iota does not mean anything for you (?). I can 
easily imagine various appropriate uses of iota in a PL, like:


* smallest representable value in a given numeric format
* threshold over which some measure should be taken into account
* threshold under which some difference should be ignored
* range for approximate equality (approxEquals: |x - y| < iota)
* tolerance interval of technical measures (similar)
* ...what else?

(I would be surprised if actual uses of iota in english do not point toward 
this kind of senses.)


Denis
--
_
vita es estrany
spir.wikidot.com



Re: Stupid little iota of an idea

2011-02-11 Thread Daniel Gibson
Am 12.02.2011 04:49, schrieb spir:
> On 02/12/2011 02:36 AM, Daniel Gibson wrote:
>> Am 12.02.2011 02:25, schrieb bearophile:
>>> Michel Fortin:
>>>
 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me,
 how do you rewrite this using the new proposed syntax:

 auto aa = [iota(a, b, c): 1, iota(d, e): 2];
>>>
>>> Right, that's why in another post I have said that syntax replaces most iota
>>> usages. There are some situations where you can't use it well. This is
>>> another situation I've shown in the enhancement request:
>>> iota(10.,20.)
>>> Writing it like this is not sane:
>>>   10...20.
>>>
>>>
 Interval is clear only as long as there's no step value mentioned.
 Having a step value is quite a stretch from the usual notion of an
 interval.
>>>
>>> Right, but I think it's acceptable still, and better than iota.
>>>
>>>
 I like a lot so's suggestion "walk". I'm not sure it's much clearer
 than iota though.
>>>
>>> It's better than iota, but not by much.
>>>
>>> Bye,
>>> bearophile
>>
>> I think it's much better. Even having "steps" (or a stepsize) is obvious with
>> walk.
>>
>> iota only makes sense when you know this from other languages/libraries or if
>> your native spoken language has a similar word that can be somehow connected.
>> http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two
>> English->German dictionaries I've checked don't either - one only listed 
>> iota as
>> the greek letter, the other had mentions about something tiny) - it's just
>> something small like that greek i-without-a-dot letter.
>> There's nothing that connects it to a range of values with a fixed step size.
> 
> That page looks listing various meanings in foreign languages, but mostly
> stincks with the greek letter; it does not mention any sense everday sense 
> iota
> actually has. Example fro fr.wiktionary:
> 
> # Nom de ι, Ι, neuvième lettre et quatrième voyelle de l’alphabet grec.
> Équivalent du i latin.
> # Petite quantité négligeable, presque rien.
> 
> Free translation: little negligible quantity, nearly nothing.
> There are good chances iota has a similar meaning in numerous languages,
> especially romance ones. Bearophile, Andrei?
> 
> Denis

I don't think a iota representing something small is too helpful.
iota() produces a (possibly very long) range of values with a possibly huge step
size (but even with a fixed step size of one it wouldn't make much sense to me).

Cheers,
- Daniel


Re: Stupid little iota of an idea

2011-02-11 Thread Jonathan M Davis
On Friday 11 February 2011 20:01:23 spir wrote:
> On 02/12/2011 03:05 AM, Jonathan M Davis wrote:
> > While iota isn't clear, it _does_ have the advantage that you're
> > not going to _mis_understand
> 
> Maybe you say this because iota does not mean anything for you (?). I can
> easily imagine various appropriate uses of iota in a PL, like:
> 
> * smallest representable value in a given numeric format
> * threshold over which some measure should be taken into account
> * threshold under which some difference should be ignored
> * range for approximate equality (approxEquals: |x - y| < iota)
> * tolerance interval of technical measures (similar)
> * ...what else?
> 
> (I would be surprised if actual uses of iota in english do not point toward
> this kind of senses.)

iota is almost entirely unused in English. You might say something like "that 
doesn't make an iota of sense," but it's pretty rare. And even if you do, it's 
an iota of _something_, so something like |x - y| < iota would be just plain 
weird. Regardless, iota would be a weird name to use for _anything_ when naming 
variables or functions. It just isn't used much in English. And there are 
pretty 
much always going to be better names for the function or variable if you're 
trying to use iota for something similar to its actual meaning. If anyone tried 
to use iota to actually mean something as a variable or function name, I'd be 
suggesting that they pick a better nam.

- Jonathan M Davis


Re: Stupid little iota of an idea

2011-02-11 Thread Brad Roberts
On 2/11/2011 4:07 PM, Andrei Alexandrescu wrote:
> On 2/11/11 8:32 AM, Daniel Gibson wrote:
>> Am 10.02.2011 12:40, schrieb spir:
>>>
>>> Certainly, because it's /highly/ important for a community of programmers to
>>> share the same "culture". And names are the main support&  vehicle for this
>>> culture.
>>>
>>> Denis
>>>
>>> (For this reason, I stoppped aliasing size_t and size_diff_t to Ordinal and
>>> Cardinal ;-) I use uint everywhere)
>>>
>>
>> This will cause trouble on 64bit systems, because there size_t is ulong.
>>
>> Cheers,
>> - Daniel
> 
> Yah... big problems on Phobos' 64-bit port.
> 
> Andrei

There were a lot of places that needed to change from uint to size_t, yes.  But 
bugs by the use of unsigned.. a rather
small number.  Considering that I did the majority of the d2 64 bit work, I 
think I can say that with confidence in it's
accuracy.

Later,
Brad


Re: Stupid little iota of an idea

2011-02-11 Thread Nick Sabalausky
"Andrej Mitrovic"  wrote in message 
news:mailman.1524.1297475525.4748.digitalmar...@puremagic.com...
> On 2/12/11, Walter Bright  wrote:
>> Andrei Alexandrescu wrote:
>>> Not all users dislike iota, and besides arguments ad populum are
>>> fallacious. Iota rocks. But have at it - vote away, and I'll be glad if
>>> a better name for iota comes about.
>>
>>
>> delta
>>
>
> Now that's sexy. Makes me feel like a commander when coding D.
>
> In fact, let me dust off my old C&C cd's, I'm in the mood for some RTS.

I was just thinking Delta Force. Sniping 6-pixel-tall soldiers from across a 
voxel canyon == amazingly fantastic eye-straining fun :) Bravo team, do you 
read me?!?

Heh, speaking of great military fun:
http://unconventional-airsoft.com/2003/01/15/hand-signals-defined/





Re: Stupid little iota of an idea

2011-02-12 Thread Jérôme M. Berger
spir wrote:
> On 02/12/2011 03:05 AM, Jonathan M Davis wrote:
>> While iota isn't clear, it _does_ have the advantage that you're
>> not going to _mis_understand
> 
> Maybe you say this because iota does not mean anything for you (?). I
> can easily imagine various appropriate uses of iota in a PL, like:
> 
> * smallest representable value in a given numeric format
> * threshold over which some measure should be taken into account
> * threshold under which some difference should be ignored
> * range for approximate equality (approxEquals: |x - y| < iota)
> * tolerance interval of technical measures (similar)
> * ...what else?
> 
Range with a single element (i.e the smallest non-empty range).
Which is actually how I interpreted “iota” the first time I saw it
(since it was obvious from the context that it was a range).

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



signature.asc
Description: OpenPGP digital signature


Re: Stupid little iota of an idea

2011-02-12 Thread Jérôme M. Berger
spir wrote:
> On 02/12/2011 01:55 AM, bearophile wrote:
>> 4) My fourth choice is "iota". It's short and it sticks in mind.
> 
> 'Ψ' "psi" (beeing the forelast letter of the alphabet, just before
> omega, as everyone knows) would nicely suggest we're dealing with
> intervals half-open on the right-hand side.
> 
Love that one! ;D

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



signature.asc
Description: OpenPGP digital signature


Re: Stupid little iota of an idea

2011-02-12 Thread Jérôme M. Berger
Walter Bright wrote:
> Andrei Alexandrescu wrote:
>> Not all users dislike iota, and besides arguments ad populum are
>> fallacious. Iota rocks. But have at it - vote away, and I'll be glad
>> if a better name for iota comes about.
> 
> 
> delta
Could be, except that this is very often used as a variable name to
represent a difference.

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



signature.asc
Description: OpenPGP digital signature


Re: Stupid little iota of an idea

2011-02-12 Thread Jérôme M. Berger
Jonathan M Davis wrote:
> On Friday 11 February 2011 20:01:23 spir wrote:
>> On 02/12/2011 03:05 AM, Jonathan M Davis wrote:
>>> While iota isn't clear, it _does_ have the advantage that you're
>>> not going to _mis_understand
>> Maybe you say this because iota does not mean anything for you (?). I can
>> easily imagine various appropriate uses of iota in a PL, like:
>>
>> * smallest representable value in a given numeric format
>> * threshold over which some measure should be taken into account
>> * threshold under which some difference should be ignored
>> * range for approximate equality (approxEquals: |x - y| < iota)
>> * tolerance interval of technical measures (similar)
>> * ...what else?
>>
>> (I would be surprised if actual uses of iota in english do not point toward
>> this kind of senses.)
> 
> iota is almost entirely unused in English. You might say something like "that 
> doesn't make an iota of sense," but it's pretty rare. And even if you do, 
> it's 
> an iota of _something_, so something like |x - y| < iota would be just plain 
> weird. Regardless, iota would be a weird name to use for _anything_ when 
> naming 
> variables or functions. It just isn't used much in English. And there are 
> pretty 
> much always going to be better names for the function or variable if you're 
> trying to use iota for something similar to its actual meaning. If anyone 
> tried 
> to use iota to actually mean something as a variable or function name, I'd be 
> suggesting that they pick a better nam.
> 
It is used enough to make it into the Collins Cobuild dictionary,
which uses statistics on word occurrences to decide whether they
should be included. One of the examples they regard as typical is:
“I don't think you've change an iota”, which means more or less
“|new - old| < iota”, so it is not that far fetched.

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



signature.asc
Description: OpenPGP digital signature


Re: Stupid little iota of an idea

2011-02-12 Thread Olivier Pisano

Le 12/02/11 01:55, bearophile a écrit :

Andrei:


Not all users dislike iota,


A poll will tell how much this statement is true :-)



and besides arguments ad populum are fallacious.


That's true for scientific and engineering (or medical, etc) things but names are not a 
science. The process of choosing names is part of ergonomics, it must deal with what 
people, with what they find closer to their mind, culture, brain. Python developers 
discuss carefully about naming, and indeed, Python names are sometimes better than Phobos 
ones. One of the problems here is that the mind of every person, you, me, Walter's has 
"quirks", that is mind processes not shared by most other people. So if a 
single person chooses names, those quirks come out, and the names are uniform (because 
they are chosen using the same strategy, and this is positive), but sometimes they also 
reflect those quirks. The only way I know to avoid this problem is to design names using 
polls :-)



I fully agree with you Bearophile.




Iota rocks. But have at it - vote away, and I'll be glad if
a better name for iota comes about.


I am not going to invent a new wonderful name for it, sorry :-) My votes, in 
decreasing order of preference:
1) By far, a syntax like a..b:c, or missing that, a syntax like a..b
2) If first class interval syntax is really not possible, then my second choice is a 
function named "range". This is what Python uses, it's natural, short enough, 
and good.
3) If you refuse the word "range", then my third choice is "interval". It's as 
cleas as range, but it's a bit worse because it's longer.
4) My fourth choice is "iota". It's short and it sticks in mind.



I am certainly not a regular poster here, so my opinion is likely to be 
less taken into account, but as a simple D user whose primary language 
is not English, here is my humble contribution (FWIW) :


1) I'd like to have the a..b syntax.
2) I think I like "interval" the most. It is certainly longer than iota 
to write, but as code is certainly much more read than written, I think 
it is an acceptable tradeoff. I guess Phobos does already functions with 
names longer than 7 chars, doesn't it ?


If you take Andrei's example :

  filter!`a % 2 == 0`(iota(1, 5))

and

  filter!`a % 2 == 0`(interval(1, 5))

I believe the second is likely to be more informative in terms of what 
the function does to a newcoming user. Interval comes from latin and 
latin-derived languages are quite widespread around the world.


According to Google :
Spanish: intervalo
Portugese: intervalo
French: intervalle
Italian: intervallo
Romanian: interval

BTW, musical theory does use the same vocabulary (intervals and steps), 
it is certainly not a valid argument, but as music one of the most 
universal thing on this earth, I find it amusing.


3) I don't think "range" should be used here. I love it in Python, but 
Range does refer to a more generic concept in D. Using range as a 
function name could add some confusion.


4) I believe a function name should tell what it does. An alphabet 
letter (greek or not) is a poor indication and should be avoided. "sum" 
is a more reasonable choice than "epsilon", even if that what we all 
write in math.


My two cents,

Olivier


  1   2   >