On 31.10.2011 02:21, Mehrdad wrote:
I've written this piece of code a fair number of times:
static if (is(typeof(foo( { foo(); }
else { bar(); }
When the expression inside the condition (i.e. the call to foo()) gets
complicated, you get lots of code duplication and things become harder
to
that string mixins are seriously
overused in D. IMnsHO they should only be used as a method of last
resort. For every case I've seen where there is a alternative to a
string mixin, the alternative was cleaner.
If people don't like the static try/catch, how about: static try/else?
Probably worth
duplication and things become harder
to read.
IMHO the only problem is the is(typeof()) syntax.
Otherwise I don't see how this has any more code duplication than:
if( foo(lots_of_parameters) )
foo(lots_of_parameters);
else bar();
Huh?
sorry but I'm confused as how that's related to static try
to foo()) gets
complicated, you get lots of code duplication and things become harder
to read.
So I'm thinking, why not just introduce a 'static try'?
Something like:
static try
{
foo();
}
catch // (string ex) // perhaps let them know what the error is?
{
bar();
}
It's a clean and immensely readable
as how that's related to static try/catch...
The only benefit you'd get from static try/catch is a small reduction in
code duplication, in one specific idiom. I'm arguing that the code
duplication is no worse in this case than in anything other case in the
language. I'm not seeing why
{
...
}
Please no! I've thought for years that string mixins are seriously
overused in D. IMnsHO they should only be used as a method of last
resort. For every case I've seen where there is a alternative to a
string mixin, the alternative was cleaner.
If people don't like the static try/catch, how about
{
...
}
Please no! I've thought for years that string mixins are seriously
overused in D. IMnsHO they should only be used as a method of last
resort. For every case I've seen where there is a alternative to a
string mixin, the alternative was cleaner.
If people don't like the static try/catch, how about
lots of code duplication and things become harder
to read.
So I'm thinking, why not just introduce a 'static try'?
Something like:
static try
{
foo();
}
catch // (string ex) // perhaps let them know what the error is?
{
bar();
}
It's a clean
become harder
to read.
So I'm thinking, why not just introduce a 'static try'?
Something like:
static try
{
foo();
}
catch // (string ex) // perhaps let them know what the error is?
{
bar();
}
It's a clean and immensely readable
On Tue, 01 Nov 2011 18:33:56 +0200, dennis luehring dl.so...@gmx.net
wrote:
introduces an compiletime scope - what would the following code mean?
debug, version, static if don't create scopes.
--
Best regards,
Vladimirmailto:vladi...@thecybershadow.net
of times:
static if (is(typeof(foo( { foo(); }
else { bar(); }
When the expression inside the condition (i.e. the call to foo()) gets
complicated, you get lots of code duplication and things become harder to
read.
So I'm thinking, why not just introduce a 'static try'?
Something like
the try{...}
static try
{
--
foo1();
foo2();
foo3();
--
}
catch
{
bar();
}
im missing a description of what should happen if any of the foos fails
to compile? is then the catch part used in compilation?
the idea is too near to the syntax
are seriously
overused in D. IMnsHO they should only be used as a method of last
resort. For every case I've seen where there is a alternative to a
string mixin, the alternative was cleaner.
If people don't like the static try/catch, how about: static try/else?
Kenji Hara
2011/10/31 Mehrdadwfunct
to read.
So I'm thinking, why not just introduce a 'static try'?
Something like:
static try
{
foo();
}
catch // (string ex) // perhaps let them know what the error is?
{
bar();
}
It's a clean and immensely readable improvement IMO, and it doesn't
introduce any new keywords or any breaking
of code duplication and things become harder
to read.
So I'm thinking, why not just introduce a 'static try'?
Something like:
static try
{
foo();
}
catch // (string ex) // perhaps let them know what the error is?
{
bar();
}
It's a clean and immensely readable improvement IMO, and it doesn't
, why not just introduce a 'static try'?
Something like:
static try
{
foo();
}
catch // (string ex) // perhaps let them know what the error is?
{
bar();
}
It's a clean and immensely readable improvement IMO, and it doesn't
introduce any new keywords or any
This topic came up (again) fairly recently, and a solution was
proposed, but I found a case where that solution doesn't work.
The objective is to do a static check to see if something is callable
with particular argument types, and if so call it.
The proposed solution was to use '.init'
On Sun, Dec 7, 2008 at 7:08 PM, Christian Kamm
[EMAIL PROTECTED] wrote:
This topic came up (again) fairly recently, and a solution was
proposed, but I found a case where that solution doesn't work.
The objective is to do a static check to see if something is callable
with particular argument
18 matches
Mail list logo