On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
Are there any programming languages that extend the behaviour
of comparison operators to allow expressions such as
if (low value high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer
On Tuesday, 9 September 2014 at 08:50:51 UTC, Dejan Lekic wrote:
It is not just that... Imagine this (nothing prevents you from
doing it):
if (foo bar baz trt mrt frt /* etc */) {}
Is this bad compared to something like
areStrictlyOrdered(foo, bar, baz, trt, mtr, frt)
?
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
Are there any programming languages that extend the behaviour
of comparison operators to allow expressions such as
if (low value high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer
On Thursday, 4 September 2014 at 20:33:45 UTC, Nordlöw wrote:
On Thursday, 4 September 2014 at 20:25:52 UTC, monarch_dodra
wrote:
In the case of D, it's a C compatibility thing. Other
languages I don't know.
FYI,
auto x = 1 2 3;
as C++ is accepted (but warned about) by GCC as
On Thursday, 4 September 2014 at 20:29:09 UTC, Nordlöw wrote:
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
if (low value high)
An alternative could be
if (value in low..high)
but then the problem would be to remember that this range is
actually
[low..high[
On Friday, 5 September 2014 at 07:26:45 UTC, klpo wrote:
On Thursday, 4 September 2014 at 20:29:09 UTC, Nordlöw wrote:
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
The problem is in D [0..9] has a completely different
signification.
All the sins of the past...
On Thursday, 4 September 2014 at 22:37:11 UTC, Ary Borenszweig
wrote:
Correction: foo cannot be pure in this case. But I believe
your example
is misguiding in this case. The most common use case for this
is when
foo is pure.
No, why?
foo cannot be pure because it does io.
On Friday, 5 September 2014 at 07:49:54 UTC, eles wrote:
On Friday, 5 September 2014 at 07:26:45 UTC, klpo wrote:
On Thursday, 4 September 2014 at 20:29:09 UTC, Nordlöw wrote:
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
The problem is in D [0..9] has a completely different
Are there any programming languages that extend the behaviour of
comparison operators to allow expressions such as
if (low value high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer misinterpreting this as
if ((low value) high)
Is this the
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
Are there any programming languages that extend the behaviour
of comparison operators to allow expressions such as
if (low value high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
if (low value high)
An alternative could be
if (value in low..high)
but then the problem would be to remember that this range is
actually
[low..high[
to be compliant with range indexing semantics.
But it could
On Thursday, 4 September 2014 at 20:25:52 UTC, monarch_dodra
wrote:
In the case of D, it's a C compatibility thing. Other languages
I don't know.
FYI,
auto x = 1 2 3;
as C++ is accepted (but warned about) by GCC as
x.cpp:19:20: warning: comparisons like ‘X=Y=Z’ do not have
their
On 9/4/14, 5:03 PM, Nordlöw wrote:
Are there any programming languages that extend the behaviour of
comparison operators to allow expressions such as
if (low value high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer misinterpreting this as
On Thursday, 4 September 2014 at 20:45:41 UTC, Ary Borenszweig
wrote:
That's because the middle expression in the comparison is first
assigned to a temporary variable, so `foo` is only invoked
once. This makes both the code more readable, efficient and
saves the programmer from having to save
On Thursday, 4 September 2014 at 22:02:20 UTC, Nordlöw wrote:
D can also, in this case, do (or will do) common sub-expression
elimination because it has a strict memory model (const and
immutability) and function purity (template inference).
Correction: foo cannot be pure in this case. But I
On 09/04/2014 04:03 PM, Nordlöw wrote:
Are there any programming languages that extend the behaviour of comparison
operators to allow expressions such as
if (low value high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer misinterpreting
On 9/4/14, 7:03 PM, Nordlöw wrote:
On Thursday, 4 September 2014 at 22:02:20 UTC, Nordlöw wrote:
D can also, in this case, do (or will do) common sub-expression
elimination because it has a strict memory model (const and
immutability) and function purity (template inference).
Correction: foo
On Thu, 04 Sep 2014 20:29:08 +
Nordlöw via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote:
if (low value high)
An alternative could be
if (value in low..high)
and then we need new overload for 'in'
18 matches
Mail list logo