On Thursday, 20 September 2012 at 19:56:48 UTC, Jonas Drewsen
wrote:
In foreach statements the type can be inferred:
Clicked the send butten too early by mistake but I guess you get
the idea.
/Jonas
On Thursday, 20 September 2012 at 19:56:48 UTC, Jonas Drewsen
wrote:
Wouldn't it make sense to allow the same for function templates
as well:
What am I missing (except some code that needs chaging because
only param type and not name has been specified in t?
I can't see any implementation i
On 09/20/2012 09:57 PM, Jonas Drewsen wrote:
...
What am I missing (except some code that needs chaging because only
param type and not name has been specified in [i]t?
Nothing, that is about it. (C backwards-compatibility could maybe be
added) Of course, we could make upper case identifiers i
On 09/20/2012 10:52 PM, Peter Alexander wrote:
On Thursday, 20 September 2012 at 19:56:48 UTC, Jonas Drewsen wrote:
Wouldn't it make sense to allow the same for function templates as
well:
What am I missing (except some code that needs chaging because only
param type and not name has been spec
On Thursday, September 20, 2012 21:57:47 Jonas Drewsen wrote:
> In foreach statements the type can be inferred:
>
> foreach (MyFooBar fooBar; fooBars) writeln(fooBar);
> same as:
> foreach (foobar; fooBars) writeln(fooBar);
>
> This is nice and tidy.
> Wouldn't it make sense to allow the same for
On Thursday, 20 September 2012 at 21:39:31 UTC, Jonathan M Davis
wrote:
On Thursday, September 20, 2012 21:57:47 Jonas Drewsen wrote:
In foreach statements the type can be inferred:
foreach (MyFooBar fooBar; fooBars) writeln(fooBar);
same as:
foreach (foobar; fooBars) writeln(fooBar);
This is
I'll add that delegate literals already allow a similar syntax, so, for
consistency reasons, this is something that make sense.
On Friday, September 21, 2012 13:14:56 Jonas Drewsen wrote:
> Maybe I wasn't clear in my suggestion. The new syntax in simply a
> way to define a templated function - not a non-templated one ie:
>
> auto foo(a,b) {}
> is exactly the same as
> auto foo(A,B)(A a, B b) {}
So all it does is save you
On Thursday, 20 September 2012 at 21:04:15 UTC, Timon Gehr wrote:
On 09/20/2012 10:52 PM, Peter Alexander wrote:
Like it or not, templates still cause a lot of code bloat,
complicate
linking, cannot be virtual, increase compilation resources,
and generate
difficult to understand messages. They
On Thu, 20 Sep 2012 15:57:47 -0400, Jonas Drewsen
wrote:
In foreach statements the type can be inferred:
foreach (MyFooBar fooBar; fooBars) writeln(fooBar);
same as:
foreach (foobar; fooBars) writeln(fooBar);
This is nice and tidy.
Wouldn't it make sense to allow the same for function templ
Although I like it, I wonder if it works in D's context free
grammar. Timon probably would know best...
I came up with this code, which compiles today:
import std.stdio;
alias int x;
void foo(x) {}
void foo2(string x) {writeln(x);}
void main()
{
foo(1);
foo2("hello");
}
Under your
On Friday, 21 September 2012 at 11:40:54 UTC, Jonathan M Davis
wrote:
On Friday, September 21, 2012 13:14:56 Jonas Drewsen wrote:
Maybe I wasn't clear in my suggestion. The new syntax in
simply a
way to define a templated function - not a non-templated one
ie:
auto foo(a,b) {}
is exactly the
On Friday, 21 September 2012 at 15:04:14 UTC, Steven
Schveighoffer wrote:
On Thu, 20 Sep 2012 15:57:47 -0400, Jonas Drewsen
wrote:
In foreach statements the type can be inferred:
foreach (MyFooBar fooBar; fooBars) writeln(fooBar);
same as:
foreach (foobar; fooBars) writeln(fooBar);
This is
On 2012-09-21, 21:29, Jonas Drewsen wrote:
A mentioned in the proposal (albeit not very clear) it requires
non-templated function definitions to include both type and param names.
If only one name is provided in a definition is always a param name.
Unfortunately this is a breaking change fo
On Saturday, 22 September 2012 at 07:48:14 UTC, Simen Kjaeraas
wrote:
On 2012-09-21, 21:29, Jonas Drewsen wrote:
A mentioned in the proposal (albeit not very clear) it
requires non-templated function definitions to include both
type and param names. If only one name is provided in a
definitio
On Monday, September 24, 2012 10:37:04 Jonas Drewsen wrote:
> On Saturday, 22 September 2012 at 07:48:14 UTC, Simen Kjaeraas
>
> wrote:
> > On 2012-09-21, 21:29, Jonas Drewsen wrote:
> >> A mentioned in the proposal (albeit not very clear) it
> >> requires non-templated function definitions to inc
On Monday, 24 September 2012 at 10:05:49 UTC, Jonathan M Davis
wrote:
On Monday, September 24, 2012 10:37:04 Jonas Drewsen wrote:
On Saturday, 22 September 2012 at 07:48:14 UTC, Simen Kjaeraas
wrote:
> On 2012-09-21, 21:29, Jonas Drewsen wrote:
>> A mentioned in the proposal (albeit not very cl
On Monday, September 24, 2012 19:18:09 Jonas Drewsen wrote:
> What about:
>
> int fun() {
> return (0, "abc")[0];
> }
>
> in the comma operator case it would return 'a' as an int.
> in the tuple case it would return 0
Like I said, I'd have to examine the situation more closely to be certain that
18 matches
Mail list logo