www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: shouting versus dotting

reply Jason House <jason.james.house gmail.com> writes:
Andrei Alexandrescu Wrote:

 Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 12:06 AM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 The problem I see with "!" as a template instantiation is not technical. I
 write a fair amount of templated code and over years the "!" did not grow on
 me at all. I was time and again consoled by Walter than one day that will
 happen, but it never did. I also realized that Walter didn't see a problem
 with it because he writes only little template code.

 I didn't have much beef with other oddities unique to D. For example, I
 found no problem accommodating binary "~" and I was wondering what makes "!"
 different. I was just looking at a page full of templates and it looked like
 crap.

 One morning I woke up with the sudden realization of what the problem was:
 the shouting.

 In C, "!" is used as a unary operator. That may seem odd at first, but it
 nevers follows a word so it's tenuous to associate it with the natural
 language "!". In D, binary "!" _always_ follows a word, a name, something
 coming from natural language. So the conotation with exclamation jumps at
 you.

 That's why I find the choice of "!" poor. I believe it can impede to some
 extent acquisition of templates by newcomers, and conversely I believe that
 using .() can make templates more palatable. I tried using ".()" in my code
 and in only a couple of days it looked and felt way better to me. Based on
 that experience, I suggest that "!()" is dropped in favor of ".()" for
 template instantiation for D2.

 Sean's argument that "The exclamation mark signifies an assertion of sorts"
 is exactly where I'd want templates not to be: they should be blended in,
 not a hiccup from normal code. Serious effort has been, and still is, made
 in D to avoid shell-shocking people about use of templates, and I think
 ".()" would be a good step in that direction.

Long argument short: I don't mind !() at all, and changing it to .() seems like a pointless pedanticism. But since you're the one suggesting it, there's a very good chance of it getting into the language (if it hasn't already), so there's not much use arguing against it.

It won't make it unless others try it and find it palatable too. But please let's try it first. Also, I'm much less keen on introducing .() than on ousting !(), which I believe was a very poor choice. So I suggest we all explore other syntax choices until we find something that we can show to the world with a straight face. Andrei

I have no trouble telling the world about !(). It's simple and clean. In fact, I already have told C++ folk about it when contrasting to <>. If I had to enumerate popular choices in the order of my preferences: 1. {} 2. !() 3. :() 4. .() The large advantage of {} is that it's a single character. !() has precedent going for it. IMHO, deeply nested !() should use alias statements just like deeply nested () should. :() is about as good as !() except for ambiguity with the archaic ?: syntax and labels. .() is just strange. It looks like template code trying to look like normal code... Kind of like how I hate manifest constants looking like enums.
Oct 05 2008
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Jason House wrote:
 Andrei Alexandrescu Wrote:
 
 Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 12:06 AM, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:
 The problem I see with "!" as a template instantiation is not
 technical. I write a fair amount of templated code and over
 years the "!" did not grow on me at all. I was time and again
 consoled by Walter than one day that will happen, but it never
 did. I also realized that Walter didn't see a problem with it
 because he writes only little template code.
 
 I didn't have much beef with other oddities unique to D. For
 example, I found no problem accommodating binary "~" and I was
 wondering what makes "!" different. I was just looking at a
 page full of templates and it looked like crap.
 
 One morning I woke up with the sudden realization of what the
 problem was: the shouting.
 
 In C, "!" is used as a unary operator. That may seem odd at
 first, but it nevers follows a word so it's tenuous to
 associate it with the natural language "!". In D, binary "!"
 _always_ follows a word, a name, something coming from natural
 language. So the conotation with exclamation jumps at you.
 
 That's why I find the choice of "!" poor. I believe it can
 impede to some extent acquisition of templates by newcomers,
 and conversely I believe that using .() can make templates more
 palatable. I tried using ".()" in my code and in only a couple
 of days it looked and felt way better to me. Based on that
 experience, I suggest that "!()" is dropped in favor of ".()"
 for template instantiation for D2.
 
 Sean's argument that "The exclamation mark signifies an
 assertion of sorts" is exactly where I'd want templates not to
 be: they should be blended in, not a hiccup from normal code.
 Serious effort has been, and still is, made in D to avoid
 shell-shocking people about use of templates, and I think ".()"
 would be a good step in that direction.

.() seems like a pointless pedanticism. But since you're the one suggesting it, there's a very good chance of it getting into the language (if it hasn't already), so there's not much use arguing against it.

But please let's try it first. Also, I'm much less keen on introducing .() than on ousting !(), which I believe was a very poor choice. So I suggest we all explore other syntax choices until we find something that we can show to the world with a straight face. Andrei

I have no trouble telling the world about !(). It's simple and clean. In fact, I already have told C++ folk about it when contrasting to <>.

I see no shouting in "simple and clean". The <> syntax was extraordinarily luring and of overwhelming popularity, to the extent that the sirens' song blindsided most people about its inherent issues. Go figure. Therefore I'd say, !() has objective advantages but subjective disadvantages over <>.
 If I had to enumerate popular choices in the order of my preferences:
 
 
 1. {} 2. !() 3. :() 4. .()
 
 The large advantage of {} is that it's a single character.
 
 !() has precedent going for it. IMHO, deeply nested !() should use
 alias statements just like deeply nested () should.
 
 :() is about as good as !() except for ambiguity with the archaic ?:
 syntax and labels.
 
 .() is just strange. It looks like template code trying to look like
 normal code... Kind of like how I hate manifest constants looking
 like enums.

Enums always were manifest constants. But I digress. Clearly there is no objective argument in choosing template instantiation arguments beyond "it causes no parsing problems". I'm glad people are considering {}. Maybe there is a way of ending this conversation without shouting. Andrei
Oct 05 2008
parent reply Sean Kelly <sean invisibleduck.org> writes:
Andrei Alexandrescu wrote:
 Jason House wrote:
 Andrei Alexandrescu Wrote:

 Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 12:06 AM, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:
 The problem I see with "!" as a template instantiation is not
 technical. I write a fair amount of templated code and over
 years the "!" did not grow on me at all. I was time and again
 consoled by Walter than one day that will happen, but it never
 did. I also realized that Walter didn't see a problem with it
 because he writes only little template code.

 I didn't have much beef with other oddities unique to D. For
 example, I found no problem accommodating binary "~" and I was
 wondering what makes "!" different. I was just looking at a
 page full of templates and it looked like crap.

 One morning I woke up with the sudden realization of what the
 problem was: the shouting.

 In C, "!" is used as a unary operator. That may seem odd at
 first, but it nevers follows a word so it's tenuous to
 associate it with the natural language "!". In D, binary "!"
 _always_ follows a word, a name, something coming from natural
 language. So the conotation with exclamation jumps at you.

 That's why I find the choice of "!" poor. I believe it can
 impede to some extent acquisition of templates by newcomers,
 and conversely I believe that using .() can make templates more
 palatable. I tried using ".()" in my code and in only a couple
 of days it looked and felt way better to me. Based on that
 experience, I suggest that "!()" is dropped in favor of ".()"
 for template instantiation for D2.

 Sean's argument that "The exclamation mark signifies an
 assertion of sorts" is exactly where I'd want templates not to
 be: they should be blended in, not a hiccup from normal code.
 Serious effort has been, and still is, made in D to avoid
 shell-shocking people about use of templates, and I think ".()"
 would be a good step in that direction.

.() seems like a pointless pedanticism. But since you're the one suggesting it, there's a very good chance of it getting into the language (if it hasn't already), so there's not much use arguing against it.

But please let's try it first. Also, I'm much less keen on introducing .() than on ousting !(), which I believe was a very poor choice. So I suggest we all explore other syntax choices until we find something that we can show to the world with a straight face. Andrei

I have no trouble telling the world about !(). It's simple and clean. In fact, I already have told C++ folk about it when contrasting to <>.

I see no shouting in "simple and clean". The <> syntax was extraordinarily luring and of overwhelming popularity, to the extent that the sirens' song blindsided most people about its inherent issues.

Makes sense. The <> syntax has a basis in mathematics. Too bad it just doesn't work in practice.
 I'm glad people are considering {}. Maybe there is a way of ending this 
 conversation without shouting.

If this were an option, why did Walter originally choose !()? Sean
Oct 05 2008
parent reply "Bent Rasmussen" <IncredibleShrinkingSphere Gmail.com> writes:
I assume,

- it was the path of least resistance
- it looks close to function call syntax f!(x), which
- is closer to intent than grouping statements, as with f{x}

- Bent


"Sean Kelly" <sean invisibleduck.org> skrev i meddelelsen 
news:gcb4p5$1id0$1 digitalmars.com...
 Andrei Alexandrescu wrote:
 Jason House wrote:
 Andrei Alexandrescu Wrote:

 Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 12:06 AM, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:
 The problem I see with "!" as a template instantiation is not
 technical. I write a fair amount of templated code and over
 years the "!" did not grow on me at all. I was time and again
 consoled by Walter than one day that will happen, but it never
 did. I also realized that Walter didn't see a problem with it
 because he writes only little template code.

 I didn't have much beef with other oddities unique to D. For
 example, I found no problem accommodating binary "~" and I was
 wondering what makes "!" different. I was just looking at a
 page full of templates and it looked like crap.

 One morning I woke up with the sudden realization of what the
 problem was: the shouting.

 In C, "!" is used as a unary operator. That may seem odd at
 first, but it nevers follows a word so it's tenuous to
 associate it with the natural language "!". In D, binary "!"
 _always_ follows a word, a name, something coming from natural
 language. So the conotation with exclamation jumps at you.

 That's why I find the choice of "!" poor. I believe it can
 impede to some extent acquisition of templates by newcomers,
 and conversely I believe that using .() can make templates more
 palatable. I tried using ".()" in my code and in only a couple
 of days it looked and felt way better to me. Based on that
 experience, I suggest that "!()" is dropped in favor of ".()"
 for template instantiation for D2.

 Sean's argument that "The exclamation mark signifies an
 assertion of sorts" is exactly where I'd want templates not to
 be: they should be blended in, not a hiccup from normal code.
 Serious effort has been, and still is, made in D to avoid
 shell-shocking people about use of templates, and I think ".()"
 would be a good step in that direction.

.() seems like a pointless pedanticism. But since you're the one suggesting it, there's a very good chance of it getting into the language (if it hasn't already), so there's not much use arguing against it.

But please let's try it first. Also, I'm much less keen on introducing .() than on ousting !(), which I believe was a very poor choice. So I suggest we all explore other syntax choices until we find something that we can show to the world with a straight face. Andrei

I have no trouble telling the world about !(). It's simple and clean. In fact, I already have told C++ folk about it when contrasting to <>.

I see no shouting in "simple and clean". The <> syntax was extraordinarily luring and of overwhelming popularity, to the extent that the sirens' song blindsided most people about its inherent issues.

Makes sense. The <> syntax has a basis in mathematics. Too bad it just doesn't work in practice.
 I'm glad people are considering {}. Maybe there is a way of ending this 
 conversation without shouting.

If this were an option, why did Walter originally choose !()? Sean

Oct 05 2008
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Bent Rasmussen wrote:
 I assume,
 
 - it was the path of least resistance
 - it looks close to function call syntax f!(x), which
 - is closer to intent than grouping statements, as with f{x}

Knowing Walter, I also believe he wanted to build on his success with using the unary operator "~" as a binary operator. "!" was the only exclusively unary operator left. I think somebody in this thread already mentioned that hypothesis. Only Walter knows :o). In wake of the realization that many (most?) template instantiations are only made with one argument, I'm currently more interested in finding a good replacement for "!" than in finding a good replacement for "()", as the former will cater the more frequent case. But I'm glad so many good ideas have been brought here. Andrei
Oct 05 2008
prev sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
I just realized something different. After making an informal review of 
some code, I saw that a large percentage of template instantiations only 
need ONE argument.

This makes me think, with the old "!" notation, parentheses could be 
dropped entirely without prejudice:

auto covariance = Matrix!real(n, n);
auto normalized = SparseVector!double(n);

and so on.

To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
work for template instantiation because without the parentheses it DOES 
engender ambiguity.

Now say we take the following route:

1) We find something different from shouting

2) We drop the parentheses for 1 argument

That sounds like a possible winner. In this case the "#" becomes 
considerably more attractive, in fact very attractive exactly because it 
looks unlike any letter:

auto covariance = Matrix#real(n, n);
auto normalized = SparseVector#double(n);

Ideas?


Andrei

P.S. The Sad Pirate is the emoticon

.(

It doesn't have an eye and is sad, too.
Oct 05 2008
next sibling parent KennyTM~ <kennytm gmail.com> writes:
Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.
 
 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:
 
 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);
 
 and so on.
 
 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it DOES 
 engender ambiguity.
 
 Now say we take the following route:
 
 1) We find something different from shouting
 
 2) We drop the parentheses for 1 argument
 
 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:
 
 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);
 
 Ideas?
 
 
 Andrei
 
 P.S. The Sad Pirate is the emoticon
 
 .(
 
 It doesn't have an eye and is sad, too.

Ouch. # is too big. Matrix#real looks like one word to me. I'd rather the source code to shout at me than to confuse me :)
Oct 05 2008
prev sibling next sibling parent reply "Denis Koroskin" <2korden gmail.com> writes:
On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu  
<SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal review of  
 some code, I saw that a large percentage of template instantiations only  
 need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be  
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't  
 work for template instantiation because without the parentheses it DOES  
 engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes  
 considerably more attractive, in fact very attractive exactly because it  
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me): const int n = 42; auto covariance = Matrix!(real, n, n); <-> auto covariance = Matrix#real(n,n); *or* auto covariance = Matrix!(real)(n, n); <-> auto covariance = Matrix#real(n,n); Other than that Vector real or Vector#real both sound good! (BTW, don't start new thread by repling to some other one, please)
Oct 05 2008
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:
 
 I just realized something different. After making an informal review 
 of some code, I saw that a large percentage of template instantiations 
 only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it 
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because 
 it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);
 
 *or*
 
 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.
 (BTW, don't start new thread by repling to some other one, please)

Just trying to keep various juice flavors separate. :o) Andrei
Oct 05 2008
next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
Andrei Alexandrescu escribió:
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal review 
 of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it 
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because 
 it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.

I like Vector real. Also: HashMap (Key, Value) looks nice to me. The only thing is that in spanish keboards, I have to do alt-gr + Q to get one :-P
Oct 05 2008
parent reply KennyTM~ <kennytm gmail.com> writes:
Ary Borenszweig wrote:
 Andrei Alexandrescu escribió:
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal review 
 of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it 
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly 
 because it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.

I like Vector real. Also: HashMap (Key, Value) looks nice to me. The only thing is that in spanish keboards, I have to do alt-gr + Q to get one :-P

It seems that Stack!int Stack int Stack#int are the only choices we're left with. All others are either binary operators, delimiters or some kind of parenthesis. But frankly speaking all of these characters are not very pretty :/
Oct 05 2008
next sibling parent KennyTM~ <kennytm gmail.com> writes:
KennyTM~ wrote:
 Ary Borenszweig wrote:
 Andrei Alexandrescu escribió:
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal 
 review of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could 
 be dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot 
 won't work for template instantiation because without the 
 parentheses it DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly 
 because it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.

I like Vector real. Also: HashMap (Key, Value) looks nice to me. The only thing is that in spanish keboards, I have to do alt-gr + Q to get one :-P

It seems that Stack!int Stack int Stack#int are the only choices we're left with. All others are either binary operators, delimiters or some kind of parenthesis. But frankly speaking all of these characters are not very pretty :/

And I think # will cause problem if a name a class "line": Stack#line // #line integer ["filespec"]\n expected (http://www.digitalmars.com/d/2.0/lex.html#specialtokenseq)
Oct 05 2008
prev sibling next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
KennyTM~ escribió:
 
 It seems that
 
 Stack!int
 Stack int
 Stack#int

Well, another possibility is: Stack¿int? stack; HashMap¿float, long? map; Why didn't anyone mention that before? :-)
Oct 05 2008
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Ary Borenszweig wrote:
 KennyTM~ escribió:
 It seems that

 Stack!int
 Stack int
 Stack#int

Well, another possibility is: Stack¿int? stack; HashMap¿float, long? map; Why didn't anyone mention that before? :-)

You sure meant: ¿Why didn't anyone mention that before? Andrei
Oct 05 2008
parent KennyTM~ <kennytm gmail.com> writes:
Andrei Alexandrescu wrote:
 Ary Borenszweig wrote:
 KennyTM~ escribió:
 It seems that

 Stack!int
 Stack int
 Stack#int

Well, another possibility is: Stack¿int? stack; HashMap¿float, long? map; Why didn't anyone mention that before? :-)

You sure meant: ¿Why didn't anyone mention that before? Andrei

Yeah, if so I'd surely just use Stack«int» as it *is* some kind of brackets, resembles C++'s (Java, C#) Stack<int> and won't cause confusion (How will you parse Template¿true?2:1 ?) But it's better to restrict to ASCII characters only, unless you want to implement APL in D...
Oct 05 2008
prev sibling next sibling parent downs <default_357-line yahoo.de> writes:
KennyTM~ wrote:
 It seems that
 
 Stack!int
 Stack int
 Stack#int
 
 are the only choices we're left with. All others are either binary
 operators, delimiters or some kind of parenthesis. But frankly speaking
 all of these characters are not very pretty :/

How about these? Stack↑int Stack×int Stack·int Stack¬int D source and strings are Unicode, after all.
Oct 05 2008
prev sibling parent reply KennyTM~ <kennytm gmail.com> writes:
KennyTM~ wrote:
 Ary Borenszweig wrote:
 Andrei Alexandrescu escribió:
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal 
 review of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could 
 be dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot 
 won't work for template instantiation because without the 
 parentheses it DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly 
 because it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.

I like Vector real. Also: HashMap (Key, Value) looks nice to me. The only thing is that in spanish keboards, I have to do alt-gr + Q to get one :-P

It seems that Stack!int Stack int Stack#int are the only choices we're left with. All others are either binary operators, delimiters or some kind of parenthesis. But frankly speaking all of these characters are not very pretty :/

I suddenly realized you could use digraphs too. Vector::Stack::Tuple::(Positive::real, Matrix::real::(3,3)) Vector->Stack->Tuple->(Positive->real, Matrix->real->(3,3)) Vector<>Stack<>Tuple<>(Positive<>real, Matrix<>real<>(3,3)) Vector.~Stack.~Tuple.~(Positive.~real, Matrix.~real.~(3,3)) Vector\\Stack\\Tuple\\(Positive\\real, Matrix\\real\\(3,3)) Vector^^Stack^^Tuple^^(Positive^^real, Matrix^^real^^(3,3)) whatever. (These examples should not be taken seriously, but please don't restrict to only one character.)
Oct 06 2008
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
KennyTM~ wrote:
 KennyTM~ wrote:
 Ary Borenszweig wrote:
 Andrei Alexandrescu escribió:
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal 
 review of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could 
 be dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot 
 won't work for template instantiation because without the 
 parentheses it DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly 
 because it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.

I like Vector real. Also: HashMap (Key, Value) looks nice to me. The only thing is that in spanish keboards, I have to do alt-gr + Q to get one :-P

It seems that Stack!int Stack int Stack#int are the only choices we're left with. All others are either binary operators, delimiters or some kind of parenthesis. But frankly speaking all of these characters are not very pretty :/

I suddenly realized you could use digraphs too. Vector::Stack::Tuple::(Positive::real, Matrix::real::(3,3)) Vector->Stack->Tuple->(Positive->real, Matrix->real->(3,3)) Vector<>Stack<>Tuple<>(Positive<>real, Matrix<>real<>(3,3)) Vector.~Stack.~Tuple.~(Positive.~real, Matrix.~real.~(3,3)) Vector\\Stack\\Tuple\\(Positive\\real, Matrix\\real\\(3,3)) Vector^^Stack^^Tuple^^(Positive^^real, Matrix^^real^^(3,3)) whatever. (These examples should not be taken seriously, but please don't restrict to only one character.)

If you take off the restriction of one character, I'd suggest two ways of doing it: Vector:-)int:-) for those who really like templates, and: Vector:'(int:'( for those who are scared of them, don't understand them, don't like them, etc. ... like me
Oct 06 2008
parent reply KennyTM~ <kennytm gmail.com> writes:
Ary Borenszweig wrote:
 KennyTM~ wrote:
 KennyTM~ wrote:
 Ary Borenszweig wrote:
 Andrei Alexandrescu escribió:
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal 
 review of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could 
 be dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot 
 won't work for template instantiation because without the 
 parentheses it DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly 
 because it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.

I like Vector real. Also: HashMap (Key, Value) looks nice to me. The only thing is that in spanish keboards, I have to do alt-gr + Q to get one :-P

It seems that Stack!int Stack int Stack#int are the only choices we're left with. All others are either binary operators, delimiters or some kind of parenthesis. But frankly speaking all of these characters are not very pretty :/

I suddenly realized you could use digraphs too. Vector::Stack::Tuple::(Positive::real, Matrix::real::(3,3)) Vector->Stack->Tuple->(Positive->real, Matrix->real->(3,3)) Vector<>Stack<>Tuple<>(Positive<>real, Matrix<>real<>(3,3)) Vector.~Stack.~Tuple.~(Positive.~real, Matrix.~real.~(3,3)) Vector\\Stack\\Tuple\\(Positive\\real, Matrix\\real\\(3,3)) Vector^^Stack^^Tuple^^(Positive^^real, Matrix^^real^^(3,3)) whatever. (These examples should not be taken seriously, but please don't restrict to only one character.)

If you take off the restriction of one character, I'd suggest two ways of doing it: Vector:-)int:-) for those who really like templates, and: Vector:'(int:'( for those who are scared of them, don't understand them, don't like them, etc. ... like me

But :'( is ambiguous... :'( (All of my suggestions, even though they're intentionally crap, do not coincide with existing syntax and cause ambiguities.) Oh one more. If we allow -- to be binary we get the ink-saving solution Vector--Stack--Tuple--(Positive--real, Matrix--real--(3,3)) it looks like a spreadsheet header to me. (OK Seriously I think a!b is good enough, and a{b} is better.)
Oct 06 2008
parent superdan <super dan.org> writes:
KennyTM~ Wrote:
 (OK Seriously I think a!b is good enough, and a{b} is better.)

second that.
Oct 06 2008
prev sibling parent "Bent Rasmussen" <IncredibleShrinkingSphere Gmail.com> writes:
I somewhat dislike  ; but the reason why it is liked is maybe that it looks 
like a 1-slice into a theoretical type array.

It was (and maybe still is) possible to use   as array index infix operator 
in Eiffel, i.e. a i, but this is maybe an example of syntax compression 
moved one step too far.

Some comparisons

    Matrix!(real)(n,n);
    Matrix real(n,n);
    Matrix[real](n,n);
    Matrix(real)(n,n);

D code has already improved syntax uniformity; adorably

    pure A[] mid(A)(A[] a, A[] b)

- Bent

"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> skrev i meddelelsen 
news:gcb2a2$1d0e$2 digitalmars.com...
 Denis Koroskin wrote:
 On Sun, 05 Oct 2008 22:18:26 +0400, Andrei Alexandrescu 
 <SeeWebsiteForEmail erdani.org> wrote:

 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it DOES 
 engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Just to clarify things: Do you propose moving the first template argument outside of the parentheses *or* ditching them iff there is only one parameter? I mean, what does the original code look like, because there is ambiguaty in your statement (to me):

Ditch parens if there's only one argument. In that case the extra character becomes an enabling asset, not a liability.
 const int n = 42;
 auto covariance = Matrix!(real, n, n); <-> auto covariance = 
 Matrix#real(n,n);

 *or*

 auto covariance = Matrix!(real)(n, n); <-> auto covariance = 
 Matrix#real(n,n);

The latter.
 Other than that Vector real or Vector#real both sound good!

I agree. In fact "Vector at real" sounds like a good way of talking about templates instead of "Vector instantiated with real". One reason for which I think "this" is a poor choice (as opposed to e.g. "self") is that it's very hard to talk about it.
 (BTW, don't start new thread by repling to some other one, please)

Just trying to keep various juice flavors separate. :o) Andrei

Oct 05 2008
prev sibling parent Yigal Chripun <yigal100 gmail.com> writes:
if "!" is removed from template instantiation than perhaps it could be
used as part of identifiers in the future?

Ruby uses the following convention which I like:

sort(array) // *new* sorted array is returned

Vs.

sort!(array) // sort array in place

Ruby also uses ? for boolean functions, so

isValid(something)

will be in Ruby

valid?(something)

the ? can't work right now in D due to ?: ambiguity, i think.
Oct 05 2008
prev sibling next sibling parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.
 
 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:
 
 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);
 
 and so on.
 
 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it DOES 
 engender ambiguity.
 
 Now say we take the following route:
 
 1) We find something different from shouting
 
 2) We drop the parentheses for 1 argument
 
 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:
 
 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);
 
 Ideas?

Skip 1) and a lot of folks will be happy with 2) !!!!!112 /* just to trigger your phobia */ -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode
Oct 05 2008
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Tom S wrote:
 Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review 
 of some code, I saw that a large percentage of template instantiations 
 only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it 
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because 
 it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

Skip 1) and a lot of folks will be happy with 2) !!!!!112 /* just to trigger your phobia */

Gotta go get my medication pronto!(damn, exclamation again) I meant: Gotta go get my medication pronto.(no more exclamation) Andrei
Oct 05 2008
prev sibling next sibling parent =?UTF-8?B?QWxleGFuZGVyIFDDoW5law==?= writes:
Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.
 
 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:
 
 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);
 
 and so on.
 
 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it DOES 
 engender ambiguity.
 
 Now say we take the following route:
 
 1) We find something different from shouting
 
 2) We drop the parentheses for 1 argument
 
 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:
 
 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

Doesn’t look bad. What about templates with more than one argument or even value arguments? How would those look?
 P.S. The Sad Pirate is the emoticon
 
 .(
 
 It doesn't have an eye and is sad, too.

I see .() as one-eyed monkey. :|
Oct 05 2008
prev sibling next sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.
 
 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:
 
 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);
 
 and so on.
 
 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it DOES 
 engender ambiguity.
 
 Now say we take the following route:
 
 1) We find something different from shouting
 
 2) We drop the parentheses for 1 argument

It's a bit off-topic, but why are we required to supply an empty template list when instantiating a type that has all defaulted template arguments? ie. class C( T = int, U = int ) {} auto c = new C!(); auto d = new C; // why can't it be this? I asked about this a while back but never got an answer. Sean
Oct 05 2008
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Sean Kelly wrote:
 Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review 
 of some code, I saw that a large percentage of template instantiations 
 only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it 
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

It's a bit off-topic, but why are we required to supply an empty template list when instantiating a type that has all defaulted template arguments? ie. class C( T = int, U = int ) {} auto c = new C!(); auto d = new C; // why can't it be this? I asked about this a while back but never got an answer.

I'd love that. I think there's ambiguity here: struct A(T = int) { void foo() { auto x = new A; } } A double whatever; whatever.foo; Will x be A int or A double? Andrei P.S. Boy I like the "at". Down with the shouting!
Oct 05 2008
next sibling parent =?UTF-8?B?QWxleGFuZGVyIFDDoW5law==?= writes:
Andrei Alexandrescu wrote:
 P.S. Boy I like the "at". Down with the shouting!

Great, now we’re starting the at-tacking!
Oct 05 2008
prev sibling parent Sean Kelly <sean invisibleduck.org> writes:
Andrei Alexandrescu wrote:
 Sean Kelly wrote:
 Andrei Alexandrescu wrote:
 I just realized something different. After making an informal review 
 of some code, I saw that a large percentage of template 
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it 
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

It's a bit off-topic, but why are we required to supply an empty template list when instantiating a type that has all defaulted template arguments? ie. class C( T = int, U = int ) {} auto c = new C!(); auto d = new C; // why can't it be this? I asked about this a while back but never got an answer.

I'd love that. I think there's ambiguity here: struct A(T = int) { void foo() { auto x = new A; } } A double whatever; whatever.foo; Will x be A int or A double?

Darnit, you're right. And I'm not sure I like the idea of making this behavior context-sensitive.
 P.S. Boy I like the "at". Down with the shouting!

You really hate '!', don't you? ;-) Sean
Oct 05 2008
prev sibling next sibling parent "David Wilson" <dw botanicus.net> writes:
2008/10/5 Andrei Alexandrescu <SeeWebsiteForEmail erdani.org>:
 I just realized something different. After making an informal review of some
 code, I saw that a large percentage of template instantiations only need ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
 entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

This looks more like output from a debugger than it does input for a C-like compiler. :) -1 from me.
 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work
 for template instantiation because without the parentheses it DOES engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because it
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Oct 05 2008
prev sibling next sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
"Andrei Alexandrescu" wrote
I just realized something different. After making an informal review of 
some code, I saw that a large percentage of template instantiations only 
need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work 
 for template instantiation because without the parentheses it DOES 
 engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

Not loving the missing parens. Also I still like ! more than #. I guess this is off topic, but aren't there more important problems to solve with the D language? I appreciate that you work with templates so much, but to change all of this based on a non-popular subjective opinion, without any technical advantage seems like a waste of resources and time (indeed, I feel many minutes of my life have been lost on this thread). I feel like I must respond for my vote to be counted, but this seems like a very unimportant, very specific bicycle shed color. Like Jarrett, I believe there's probably not much I can do about it, since you have your mind so tightly gripped on this shouting thing that it will probably be changed in spite of all the resistance to it. -Steve
Oct 05 2008
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Steven Schveighoffer wrote:
 "Andrei Alexandrescu" wrote
 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work 
 for template instantiation because without the parentheses it DOES 
 engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

Not loving the missing parens. Also I still like ! more than #.

Me too especially since I discovered # creates problems with #line.
 I guess this is off topic, but aren't there more important problems to solve 
 with the D language?

Well I think world hunger will have higher priority still. I have no idea how people choose what to work on at any given time, but I know it's hard to predict and hard to channel.
 I appreciate that you work with templates so much, but 
 to change all of this based on a non-popular subjective opinion, without any 
 technical advantage seems like a waste of resources and time (indeed, I feel 
 many minutes of my life have been lost on this thread).  I feel like I must 
 respond for my vote to be counted, but this seems like a very unimportant, 
 very specific bicycle shed color.

Well I think it's not fair to frame this as a "me" vs. "we" issue. It looks like quite a few people also have similar misgivings about the bang syntax. Moreover, this thread seem to actually bring even more interesting ideas to the fore. As far as popularity goes, the Sad Pirate turned out to be unpopular, and a few good point against it were being made. In the process of expressing that dislike, many people also revealed they didn't like the Slashed-Eye Sad Guy either and looked for alternatives.
 Like Jarrett, I believe there's probably not much I can do about it, since 
 you have your mind so tightly gripped on this shouting thing that it will 
 probably be changed in spite of all the resistance to it.

Probably this needs saying - I'd never plan to leverage my being close to Walter into introducing whatever change "just because I so want". Also, Walter is smarter than accepting that to start with. If that's part of your irritation about the whole discussion, I'm telling you you can safely discount it. Andrei
Oct 05 2008
parent reply "Bent Rasmussen" <IncredibleShrinkingSphere Gmail.com> writes:
I don't see how an open discussion can hurt. I guess it's only scary because 
you tend to produce heavy arguments and this is also a matter of aesthetics 
and in that war anyone can become the casualty of an opposing taste. If some 
beautiful "solution" is found then it may get express treatment, but 
otherwise I guess Walter is already working on those other priorities, not 
needing the permanent undivided attention on those priorities at all times.

- Bent


"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> skrev i meddelelsen 
news:gcb7k2$1oer$2 digitalmars.com...
 Steven Schveighoffer wrote:
 "Andrei Alexandrescu" wrote
 I just realized something different. After making an informal review of 
 some code, I saw that a large percentage of template instantiations only 
 need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work for template instantiation because without the parentheses it DOES 
 engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes 
 considerably more attractive, in fact very attractive exactly because it 
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

Not loving the missing parens. Also I still like ! more than #.

Me too especially since I discovered # creates problems with #line.
 I guess this is off topic, but aren't there more important problems to 
 solve with the D language?

Well I think world hunger will have higher priority still. I have no idea how people choose what to work on at any given time, but I know it's hard to predict and hard to channel.
 I appreciate that you work with templates so much, but to change all of 
 this based on a non-popular subjective opinion, without any technical 
 advantage seems like a waste of resources and time (indeed, I feel many 
 minutes of my life have been lost on this thread).  I feel like I must 
 respond for my vote to be counted, but this seems like a very 
 unimportant, very specific bicycle shed color.

Well I think it's not fair to frame this as a "me" vs. "we" issue. It looks like quite a few people also have similar misgivings about the bang syntax. Moreover, this thread seem to actually bring even more interesting ideas to the fore. As far as popularity goes, the Sad Pirate turned out to be unpopular, and a few good point against it were being made. In the process of expressing that dislike, many people also revealed they didn't like the Slashed-Eye Sad Guy either and looked for alternatives.
 Like Jarrett, I believe there's probably not much I can do about it, 
 since you have your mind so tightly gripped on this shouting thing that 
 it will probably be changed in spite of all the resistance to it.

Probably this needs saying - I'd never plan to leverage my being close to Walter into introducing whatever change "just because I so want". Also, Walter is smarter than accepting that to start with. If that's part of your irritation about the whole discussion, I'm telling you you can safely discount it. Andrei

Oct 05 2008
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Bent Rasmussen wrote:
 I don't see how an open discussion can hurt. I guess it's only scary 
 because you tend to produce heavy arguments and this is also a matter of 
 aesthetics and in that war anyone can become the casualty of an opposing 
 taste. If some beautiful "solution" is found then it may get express 
 treatment, but otherwise I guess Walter is already working on those 
 other priorities, not needing the permanent undivided attention on those 
 priorities at all times.

One interesting thing about all this is that the discussion is long and the implementation is simple. We are looking almost by definition for an unambiguous syntax, and such a thing is trivial to implement. Andrei
Oct 05 2008
prev sibling next sibling parent reply "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Sun, Oct 5, 2008 at 2:18 PM, Andrei Alexandrescu
<SeeWebsiteForEmail erdani.org> wrote:
 I just realized something different. After making an informal review of some
 code, I saw that a large percentage of template instantiations only need ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
 entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work
 for template instantiation because without the parentheses it DOES engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because it
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Hmm. I'm trying to think -- is there anywhere in the grammar where something like Matrix int would be legal as something else? That is, I'm suggesting that we take a page from i.e. Haskell's book, and simply allow the first argument to a template to be separated from the template name with a space. auto covariance = Matrix real(n, n); auto normalized = SparseVector double(n); Positive real x = 3.4; Positive real y = 6.8; Positive real z = y - x; // error "Identifier Identifier" does not occur anywhere in the grammar either, as far as I can tell. Matrix Positive real(n, n); Please comment!(int);
Oct 05 2008
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 2:18 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 I just realized something different. After making an informal review of some
 code, I saw that a large percentage of template instantiations only need ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
 entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work
 for template instantiation because without the parentheses it DOES engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because it
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Hmm. I'm trying to think -- is there anywhere in the grammar where something like Matrix int would be legal as something else? That is, I'm suggesting that we take a page from i.e. Haskell's book, and simply allow the first argument to a template to be separated from the template name with a space. auto covariance = Matrix real(n, n); auto normalized = SparseVector double(n); Positive real x = 3.4; Positive real y = 6.8; Positive real z = y - x; // error "Identifier Identifier" does not occur anywhere in the grammar either, as far as I can tell. Matrix Positive real(n, n); Please comment!(int);

Boy this is going somewhere. Andrei
Oct 05 2008
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 4:05 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 Jarrett Billingsley wrote:
 Please comment!(int);

Andrei

Uh, what?

I meant it sounds interesting. Ary has shown there are problems with it though. Andrei
Oct 05 2008
prev sibling next sibling parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
Jarrett Billingsley escribió:
 On Sun, Oct 5, 2008 at 2:18 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 I just realized something different. After making an informal review of some
 code, I saw that a large percentage of template instantiations only need ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
 entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work
 for template instantiation because without the parentheses it DOES engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because it
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Hmm. I'm trying to think -- is there anywhere in the grammar where something like Matrix int would be legal as something else? That is, I'm suggesting that we take a page from i.e. Haskell's book, and simply allow the first argument to a template to be separated from the template name with a space. auto covariance = Matrix real(n, n); auto normalized = SparseVector double(n); Positive real x = 3.4; Positive real y = 6.8; Positive real z = y - x; // error "Identifier Identifier" does not occur anywhere in the grammar either, as far as I can tell. Matrix Positive real(n, n); Please comment!(int);

Identifier Identifier --> Type name it's used for declarations. Then if the parser sees: Type name , that could be a template instantiation, or maybe a variable declaration. It all depends on what follows next. But I think it just can be ; or =... I'm not sure.
Oct 05 2008
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Ary Borenszweig wrote:
 Jarrett Billingsley escribió:
 On Sun, Oct 5, 2008 at 2:18 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 I just realized something different. After making an informal review 
 of some
 code, I saw that a large percentage of template instantiations only 
 need ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be 
 dropped
 entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't 
 work
 for template instantiation because without the parentheses it DOES 
 engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because it
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Hmm. I'm trying to think -- is there anywhere in the grammar where something like Matrix int would be legal as something else? That is, I'm suggesting that we take a page from i.e. Haskell's book, and simply allow the first argument to a template to be separated from the template name with a space. auto covariance = Matrix real(n, n); auto normalized = SparseVector double(n); Positive real x = 3.4; Positive real y = 6.8; Positive real z = y - x; // error "Identifier Identifier" does not occur anywhere in the grammar either, as far as I can tell. Matrix Positive real(n, n); Please comment!(int);

Identifier Identifier --> Type name it's used for declarations. Then if the parser sees: Type name , that could be a template instantiation, or maybe a variable declaration. It all depends on what follows next. But I think it just can be ; or =... I'm not sure.

Yah: void foo(a b); Did you mean an anonymous parameter of type a b, or a named parameter of type a and name b? Andrei
Oct 05 2008
prev sibling parent KennyTM~ <kennytm gmail.com> writes:
Jarrett Billingsley wrote:
 On Sun, Oct 5, 2008 at 2:18 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 I just realized something different. After making an informal review of some
 code, I saw that a large percentage of template instantiations only need ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
 entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work
 for template instantiation because without the parentheses it DOES engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because it
 looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Hmm. I'm trying to think -- is there anywhere in the grammar where something like Matrix int would be legal as something else? That is, I'm suggesting that we take a page from i.e. Haskell's book, and simply allow the first argument to a template to be separated from the template name with a space. auto covariance = Matrix real(n, n); auto normalized = SparseVector double(n); Positive real x = 3.4; Positive real y = 6.8; Positive real z = y - x; // error "Identifier Identifier" does not occur anywhere in the grammar either, as far as I can tell. Matrix Positive real(n, n); Please comment!(int);

alias int X; alias X Y; <--- identifier identifier Y y; <--- identifier identifier Also, how do I initiate a template with default argument with this syntax? (The problem has been pointed out somewhere in this thread, so that you have to call C!() instead of C)
Oct 05 2008
prev sibling next sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Sun, Oct 5, 2008 at 4:05 PM, Andrei Alexandrescu
<SeeWebsiteForEmail erdani.org> wrote:
 Jarrett Billingsley wrote:
 Please comment!(int);

Boy this is going somewhere. Andrei

Uh, what?
Oct 05 2008
prev sibling next sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Sun, Oct 5, 2008 at 4:25 PM, Ary Borenszweig <ary esperanto.org.ar> wrot=
e:
 Jarrett Billingsley escribi=F3:
 On Sun, Oct 5, 2008 at 2:18 PM, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:
 I just realized something different. After making an informal review of
 some
 code, I saw that a large percentage of template instantiations only nee=



 ONE
 argument.

 This makes me think, with the old "!" notation, parentheses could be
 dropped
 entirely without prejudice:

 auto covariance =3D Matrix!real(n, n);
 auto normalized =3D SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't wo=



 for template instantiation because without the parentheses it DOES
 engender
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because i=



 looks unlike any letter:

 auto covariance =3D Matrix#real(n, n);
 auto normalized =3D SparseVector#double(n);

 Ideas?


 Andrei

 P.S. The Sad Pirate is the emoticon

 .(

 It doesn't have an eye and is sad, too.

Hmm. I'm trying to think -- is there anywhere in the grammar where something like Matrix int would be legal as something else? That is, I'm suggesting that we take a page from i.e. Haskell's book, and simply allow the first argument to a template to be separated from the template name with a space. auto covariance =3D Matrix real(n, n); auto normalized =3D SparseVector double(n); Positive real x =3D 3.4; Positive real y =3D 6.8; Positive real z =3D y - x; // error "Identifier Identifier" does not occur anywhere in the grammar either, as far as I can tell. Matrix Positive real(n, n); Please comment!(int);

Identifier Identifier --> Type name it's used for declarations. Then if the parser sees: Type name , that could be a template instantiation, or maybe a variable declaration=

 It all depends on what follows next. But I think it just can be ; or =3D.=

 I'm not sure.

Ugh, that's a very obvious case I've missed :P It's worse if you consider something like: template Templ(T) { T Templ; } alias int foo; Templ foo =3D 5; This would parse as a variable declaration using Templ as the type and foo as the name, but it could also mean "Templ!(foo) =3D 5" which assigns 5 into the static variable held in Templ. Scratch that!
Oct 05 2008
prev sibling next sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
T24gU3VuLCBPY3QgNSwgMjAwOCBhdCA1OjM5IFBNLCBkb3ducyA8ZGVmYXVsdF8zNTctbGluZUB5
YWhvby5kZT4gd3JvdGU6Cj4gS2VubnlUTX4gd3JvdGU6Cj4+IEl0IHNlZW1zIHRoYXQKPj4KPj4g
U3RhY2shaW50Cj4+IFN0YWNrQGludAo+PiBTdGFjayNpbnQKPj4KPj4gYXJlIHRoZSBvbmx5IGNo
b2ljZXMgd2UncmUgbGVmdCB3aXRoLiBBbGwgb3RoZXJzIGFyZSBlaXRoZXIgYmluYXJ5Cj4+IG9w
ZXJhdG9ycywgZGVsaW1pdGVycyBvciBzb21lIGtpbmQgb2YgcGFyZW50aGVzaXMuIEJ1dCBmcmFu
a2x5IHNwZWFraW5nCj4+IGFsbCBvZiB0aGVzZSBjaGFyYWN0ZXJzIGFyZSBub3QgdmVyeSBwcmV0
dHkgOi8KPgo+IEhvdyBhYm91dCB0aGVzZT8KPgo+IFN0YWNr4oaRaW50Cj4gU3RhY2vDl2ludAo+
IFN0YWNrwrdpbnQKPiBTdGFja8KsaW50Cj4KPiBEIHNvdXJjZSBhbmQgc3RyaW5ncyBhcmUgVW5p
Y29kZSwgYWZ0ZXIgYWxsLgoKSSBoYXRlIHlvdSBzbyBtdWNoLgo=
Oct 05 2008
prev sibling next sibling parent reply Leandro Lucarella <llucax gmail.com> writes:
Andrei Alexandrescu, el  5 de octubre a las 13:18 me escribiste:
 I just realized something different. After making an informal review of some
code, I saw that a large percentage of template instantiations only need ONE 
 argument.
 
 This makes me think, with the old "!" notation, parentheses could be dropped
entirely without prejudice:
 
 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);
 
 and so on.
 
 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work for
template instantiation because without the parentheses it DOES engender 
 ambiguity.
 
 Now say we take the following route:
 
 1) We find something different from shouting
 
 2) We drop the parentheses for 1 argument
 
 That sounds like a possible winner. In this case the "#" becomes considerably
more attractive, in fact very attractive exactly because it looks unlike any 
 letter:
 
 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);
 
 Ideas?

I really liked downs idea, what about auto covariance = Matrix of real(n, n); auto normalized = SparseVector of double(n); auto foo = Bar of (double, Foo)(n); Or maybe reuse "with"? auto covariance = Matrix with real(n, n); auto normalized = SparseVector with double(n); auto foo = Bar with (double, Foo)(n); -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- ¿Qué será lo que hace que una brújula siempre marque el norte? - Ser aguja, nada más, y cumplir su misión. -- Ricardo Vaporeso
Oct 05 2008
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Leandro Lucarella wrote:
 Andrei Alexandrescu, el  5 de octubre a las 13:18 me escribiste:
 I just realized something different. After making an informal review of some
code, I saw that a large percentage of template instantiations only need ONE 
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work for
template instantiation because without the parentheses it DOES engender 
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes considerably
more attractive, in fact very attractive exactly because it looks unlike any 
 letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

I really liked downs idea, what about auto covariance = Matrix of real(n, n); auto normalized = SparseVector of double(n); auto foo = Bar of (double, Foo)(n); Or maybe reuse "with"? auto covariance = Matrix with real(n, n); auto normalized = SparseVector with double(n); auto foo = Bar with (double, Foo)(n);

What happened to "I feel is unnecessary to change the template instantiation syntax"? I guess you simply saw something you liked. :o) About "of" or "with": array = map of sqrt(array); inPlace with writeln(array); Guess I can rest my case now :o). Andrei
Oct 05 2008
parent Leandro Lucarella <llucax gmail.com> writes:
Andrei Alexandrescu, el  5 de octubre a las 17:47 me escribiste:
Ideas?

auto covariance = Matrix of real(n, n); auto normalized = SparseVector of double(n); auto foo = Bar of (double, Foo)(n); Or maybe reuse "with"? auto covariance = Matrix with real(n, n); auto normalized = SparseVector with double(n); auto foo = Bar with (double, Foo)(n);

What happened to "I feel is unnecessary to change the template instantiation syntax"?

Is still there, I this thread is dropped right now, I'll be just happy =) But since this doesn't look like it's going away, I'll try to push in the direction that I find less ugly. I think changing !( for .( is plain dumb. If a change will be introduced, I hope it really make a difference.
 I guess you simply saw something you liked. :o)

What I liked about downs idea was the hidden idea of improving D's tuple support ;)
 About "of" or "with":
 
 array = map of sqrt(array);
 inPlace with writeln(array);
 
 Guess I can rest my case now :o).

array = map with sqrt(array) looks just right! Come on! And I don't know what this should mean anyways so I can't pick a good name to make it clear with "with" =): inPlace.(writeln)(array); -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- - Tata Dios lo creó a usté solamente pa despertar al pueblo y fecundar las gayinas. - Otro constrasentido divino... Quieren que yo salga de joda con las hembras y después quieren que madrugue. -- Inodoro Pereyra y un gallo
Oct 06 2008
prev sibling parent reply KennyTM~ <kennytm gmail.com> writes:
Leandro Lucarella wrote:
 Andrei Alexandrescu, el  5 de octubre a las 13:18 me escribiste:
 I just realized something different. After making an informal review of some
code, I saw that a large percentage of template instantiations only need ONE 
 argument.

 This makes me think, with the old "!" notation, parentheses could be dropped
entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't work for
template instantiation because without the parentheses it DOES engender 
 ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes considerably
more attractive, in fact very attractive exactly because it looks unlike any 
 letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

I really liked downs idea, what about auto covariance = Matrix of real(n, n); auto normalized = SparseVector of double(n); auto foo = Bar of (double, Foo)(n); Or maybe reuse "with"? auto covariance = Matrix with real(n, n); auto normalized = SparseVector with double(n); auto foo = Bar with (double, Foo)(n);

auto v = new Vector with Stack with Tuple with (Positive with real, Matrix with real (3, 3)) ?
Oct 05 2008
parent reply downs <default_357-line yahoo.de> writes:
KennyTM~ wrote:
 Leandro Lucarella wrote:
 Andrei Alexandrescu, el  5 de octubre a las 13:18 me escribiste:
 I just realized something different. After making an informal review
 of some code, I saw that a large percentage of template
 instantiations only need ONE argument.

 This makes me think, with the old "!" notation, parentheses could be
 dropped entirely without prejudice:

 auto covariance = Matrix!real(n, n);
 auto normalized = SparseVector!double(n);

 and so on.

 To the unbridled joy of the enemies of the Sad Pirate, the dot won't
 work for template instantiation because without the parentheses it
 DOES engender ambiguity.

 Now say we take the following route:

 1) We find something different from shouting

 2) We drop the parentheses for 1 argument

 That sounds like a possible winner. In this case the "#" becomes
 considerably more attractive, in fact very attractive exactly because
 it looks unlike any letter:

 auto covariance = Matrix#real(n, n);
 auto normalized = SparseVector#double(n);

 Ideas?

I really liked downs idea, what about auto covariance = Matrix of real(n, n); auto normalized = SparseVector of double(n); auto foo = Bar of (double, Foo)(n); Or maybe reuse "with"? auto covariance = Matrix with real(n, n); auto normalized = SparseVector with double(n); auto foo = Bar with (double, Foo)(n);

auto v = new Vector with Stack with Tuple with (Positive with real, Matrix with real (3, 3)) ?

auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3)); Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)
Oct 06 2008
parent reply Leandro Lucarella <llucax gmail.com> writes:
downs, el  6 de octubre a las 17:28 me escribiste:
 auto v = new Vector with Stack with Tuple with (Positive with real,
 Matrix with real (3, 3)) ?

auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3)); Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)

And I don't think: auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3)) or: auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3)) or: auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3)) Is particulary nice either. You should use alias when nesting too deep, I guess. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Lo último que hay que pensar es que se desalinea la memoria Hay que priorizar como causa la idiotez propia Ya lo tengo asumido -- Pablete, filósofo contemporáneo desconocido
Oct 06 2008
next sibling parent superdan <super dan.org> writes:
Leandro Lucarella Wrote:

 downs, el  6 de octubre a las 17:28 me escribiste:
 auto v = new Vector with Stack with Tuple with (Positive with real,
 Matrix with real (3, 3)) ?

auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3));


looks like crap
 Probably suboptimal. I mostly just threw that out there as a "wouldn't it be
cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)

And I don't think: auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3))

looks as passable as `!'
 or:
 auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3))

looks good. i vote for that.
 or:
 auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3))

is at an advantage. has less parens.
Oct 06 2008
prev sibling next sibling parent reply KennyTM~ <kennytm gmail.com> writes:
Denis Koroskin wrote:
 On Mon, 06 Oct 2008 23:10:02 +0400, Leandro Lucarella <llucax gmail.com> 
 wrote:
 
 downs, el  6 de octubre a las 17:28 me escribiste:
 auto v = new Vector with Stack with Tuple with (Positive with real,
 Matrix with real (3, 3)) ?

auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3)); Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)

And I don't think: auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3)) or: auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3)) or: auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3)) Is particulary nice either. You should use alias when nesting too deep, I guess.

or: auto v = new Vector (Stack (Tuple (Positive real, Matrix real)))(3, 3) or: auto v = new Vector!(Stack!(Tuple!(Positive!(real), Matrix!(real))))(3, 3) But you shouldn't write that kind of code, anyway. This is more realistic: alias Tuple (Positive real, Matrix real) MyTuple; alias Stack MyTuple MyStack; alias Vector MyStack MyVector; But that's not a real-world example, anyway. Could anyone convert some real-world template-heavy source-code like std.algorithm to all the proposed syntaxes so that we could compare them to each other?

NxNHelper!(F).For!(Args).Result (taken from std.algorithm.reduce.) Then we have NxNHelper of F.For of Args.Result NxNHelper F.For Args.Result NxNHelper{F}.For{Args}.Result -- Tuple!(Iterator!(Range1), Iterator!(Range2)) (taken form std.algorithm.mismatch.) Then we have Tuple of (Iterator of Range1, Iterator of Range2) /* or omit Tuple of, as suggested by downs */ Tuple (Iterator Range1, Iterator Range2) Tuple{Iterator{Range1}, Iterator{Range2}}
Oct 06 2008
parent Leandro Lucarella <llucax gmail.com> writes:
KennyTM~, el  7 de octubre a las 03:39 me escribiste:
   NxNHelper!(F).For!(Args).Result
 
 (taken from std.algorithm.reduce.) Then we have
 
 
   NxNHelper of F.For of Args.Result
 
   NxNHelper F.For Args.Result
 
   NxNHelper{F}.For{Args}.Result
 
 
 --
 
   Tuple!(Iterator!(Range1), Iterator!(Range2))
 
 (taken form std.algorithm.mismatch.) Then we have
 
   Tuple of (Iterator of Range1, Iterator of Range2)
    /* or omit Tuple of, as suggested by downs */
 
   Tuple (Iterator Range1, Iterator Range2)
 
   Tuple{Iterator{Range1}, Iterator{Range2}}

They all look ugly to me... I mean *ALL* -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- La máquina de la moneda, mirá como te queda! -- Sidharta Kiwi
Oct 06 2008
prev sibling parent Christopher Wright <dhasenan gmail.com> writes:
Leandro Lucarella wrote:
 downs, el  6 de octubre a las 17:28 me escribiste:
 auto v = new Vector with Stack with Tuple with (Positive with real,
 Matrix with real (3, 3)) ?

Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)

And I don't think: auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3))

I can read this.
 auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3))

I can read this.
 auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3))

This takes more effort to read. auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3)) I can start reading that. auto v = new Vector (Stack (Tuple (Positive real, Matrix real)(3, 3)))) I can read this, but it's still not great.
 Is particulary nice either. You should use alias when nesting too deep,
 I guess.

Wholehearted agreement.
Oct 08 2008
prev sibling next sibling parent "Denis Koroskin" <2korden gmail.com> writes:
On Mon, 06 Oct 2008 23:10:02 +0400, Leandro Lucarella <llucax gmail.com>  
wrote:

 downs, el  6 de octubre a las 17:28 me escribiste:
 auto v = new Vector with Stack with Tuple with (Positive with real,
 Matrix with real (3, 3)) ?

auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3)); Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)

And I don't think: auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3)) or: auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3)) or: auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3)) Is particulary nice either. You should use alias when nesting too deep, I guess.

or: auto v = new Vector (Stack (Tuple (Positive real, Matrix real)))(3, 3) or: auto v = new Vector!(Stack!(Tuple!(Positive!(real), Matrix!(real))))(3, 3) But you shouldn't write that kind of code, anyway. This is more realistic: alias Tuple (Positive real, Matrix real) MyTuple; alias Stack MyTuple MyStack; alias Vector MyStack MyVector; But that's not a real-world example, anyway. Could anyone convert some real-world template-heavy source-code like std.algorithm to all the proposed syntaxes so that we could compare them to each other?
Oct 06 2008
prev sibling parent "Denis Koroskin" <2korden gmail.com> writes:
On Mon, 06 Oct 2008 23:39:44 +0400, KennyTM~ <kennytm gmail.com> wrote:

 Denis Koroskin wrote:
 On Mon, 06 Oct 2008 23:10:02 +0400, Leandro Lucarella  
 <llucax gmail.com> wrote:

 downs, el  6 de octubre a las 17:28 me escribiste:
 auto v = new Vector with Stack with Tuple with (Positive with real,
 Matrix with real (3, 3)) ?

auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3)); Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)

And I don't think: auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3)) or: auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3)) or: auto v = new Vector Stack Tuple (Positive real, Matrix real)(3, 3)) Is particulary nice either. You should use alias when nesting too deep, I guess.

auto v = new Vector (Stack (Tuple (Positive real, Matrix real)))(3, 3) or: auto v = new Vector!(Stack!(Tuple!(Positive!(real), Matrix!(real))))(3, 3) But you shouldn't write that kind of code, anyway. This is more realistic: alias Tuple (Positive real, Matrix real) MyTuple; alias Stack MyTuple MyStack; alias Vector MyStack MyVector; But that's not a real-world example, anyway. Could anyone convert some real-world template-heavy source-code like std.algorithm to all the proposed syntaxes so that we could compare them to each other?

NxNHelper!(F).For!(Args).Result (taken from std.algorithm.reduce.) Then we have NxNHelper of F.For of Args.Result NxNHelper F.For Args.Result

You gotta get used to it..
    NxNHelper{F}.For{Args}.Result

And this one is my favorite!
 --

    Tuple!(Iterator!(Range1), Iterator!(Range2))

 (taken form std.algorithm.mismatch.) Then we have

    Tuple of (Iterator of Range1, Iterator of Range2)
     /* or omit Tuple of, as suggested by downs */

    Tuple (Iterator Range1, Iterator Range2)

    Tuple{Iterator{Range1}, Iterator{Range2}}

Last two are equally good to me.
Oct 06 2008