On 11/21/14 7:24 PM, Eric wrote:
immutable class X
{
private int x;
this(int x) { this.x = x; }
...
override size_t toHash(); // error: can't override mutable method
}
Since toHash() cannot be overridden in an immutable class,
is there a work-around?
Kind of, but I don't thi
But think about if enforced immutability is really what you
want.
You don't need to mark the fields immutable to be able to
construct immutable Xs. A `pure` constructor is handy, as it can
construct both mutable and immutable objects.
class X
{
private int x;
this(int x) pure { this.
On Saturday, 22 November 2014 at 00:24:39 UTC, Eric wrote:
immutable class X
{
private int x;
this(int x) { this.x = x; }
...
override size_t toHash(); // error: can't override mutable
method
}
Since toHash() cannot be overridden in an immutable class,
is there a work-around?
I
immutable class X
{
private int x;
this(int x) { this.x = x; }
...
override size_t toHash(); // error: can't override mutable
method
}
Since toHash() cannot be overridden in an immutable class,
is there a work-around?
In other words,
immutable X x1 = new immutable X(5);
immutab
On Friday, 21 November 2014 at 22:52:54 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Fri, Nov 21, 2014 at 10:30:51PM +, Eric via
Digitalmars-d-learn wrote:
On Friday, 21 November 2014 at 22:25:32 UTC, anonymous wrote:
>On Friday, 21 November 2014 at 22:15:37 UTC, Eric wrote:
[...]
>>I
On Friday, 21 November 2014 at 22:30:52 UTC, Eric wrote:
On Friday, 21 November 2014 at 22:25:32 UTC, anonymous wrote:
On Friday, 21 November 2014 at 22:15:37 UTC, Eric wrote:
[...]
class X { }
class Y : X { }
Y y = new Y;
X x = y;
[...]
I have't quite mastered the whole is/typeof/typeid
t
On Fri, Nov 21, 2014 at 10:30:51PM +, Eric via Digitalmars-d-learn wrote:
> On Friday, 21 November 2014 at 22:25:32 UTC, anonymous wrote:
> >On Friday, 21 November 2014 at 22:15:37 UTC, Eric wrote:
[...]
> >>Is there a way I can check the type of x without doing
> >>a string comparison?
> >>
>
On Friday, 21 November 2014 at 22:25:32 UTC, anonymous wrote:
On Friday, 21 November 2014 at 22:15:37 UTC, Eric wrote:
Suppose I have:
module test;
class X { }
class Y : X { }
Y y = new Y;
X x = y;
assert(is(typeof(x) == test.Y); // this assertion will fail
assert(typeid(x).toString() == "t
On Friday, 21 November 2014 at 22:15:37 UTC, Eric wrote:
Suppose I have:
module test;
class X { }
class Y : X { }
Y y = new Y;
X x = y;
assert(is(typeof(x) == test.Y); // this assertion will fail
assert(typeid(x).toString() == "test.Y"); // this assertion
will pass
Is there a way I can ch
Suppose I have:
module test;
class X { }
class Y : X { }
Y y = new Y;
X x = y;
assert(is(typeof(x) == test.Y); // this assertion will fail
assert(typeid(x).toString() == "test.Y"); // this assertion will
pass
Is there a way I can check the type of x without doing
a string comparison?
-Eri
On Friday, 21 November 2014 at 17:43:27 UTC, Ary Borenszweig
wrote:
What's concatenation by juxtaposition?
When "foo" "bar" turns into "foobar". The two string literals are
right next to each other, no operator or anything else in
between, so they are combined.
On 11/21/14, 2:46 PM, Adam D. Ruppe wrote:
On Friday, 21 November 2014 at 17:43:27 UTC, Ary Borenszweig wrote:
What's concatenation by juxtaposition?
When "foo" "bar" turns into "foobar". The two string literals are right
next to each other, no operator or anything else in between, so they are
On 11/21/14, 1:59 PM, "Marc Schütz" " wrote:
On Friday, 21 November 2014 at 15:00:31 UTC, ketmar via
Digitalmars-d-learn wrote:
On Thu, 20 Nov 2014 14:23:23 -0300
Ary Borenszweig via Digitalmars-d-learn
wrote:
This way you avoid silly typing mistakes while at the same time you
allow splitting
On Friday, 21 November 2014 at 15:00:31 UTC, ketmar via
Digitalmars-d-learn wrote:
On Thu, 20 Nov 2014 14:23:23 -0300
Ary Borenszweig via Digitalmars-d-learn
wrote:
This way you avoid silly typing mistakes while at the same
time you allow splitting a string across several lines without
having
Am Thu, 20 Nov 2014 20:17:31 +
schrieb "Charles" :
> So I was reading the documentation page:
> http://dlang.org/simd.html and noticed what appears to be a typo:
>
> int4 v;
> (cast(int*)&v)[3] = 2; // set 3rd element of the 4 int vector
> (cast(int[4])v)[3] = 2; // set 3rd element of the
On Thu, 20 Nov 2014 14:23:23 -0300
Ary Borenszweig via Digitalmars-d-learn
wrote:
> This way you avoid silly typing mistakes while at the same time you
> allow splitting a string across several lines without having to
> concatenate them at runtime.
i bet that current D frontend is able to conca
On Thursday, 20 November 2014 at 22:35:51 UTC, IgorStepanov wrote:
class Patt
{
// It is better then your static if.
// Compiler will raise better error message for incorrect
operator.
Seq opBinary(string op)(Patt rhs) if (op == "~")
{
return opCatImpl(rhs);
}
p
On Friday, 21 November 2014 at 01:22:34 UTC, Mike Parker wrote:
On 11/21/2014 5:57 AM, Paul wrote:
This is a tad off topic now but I'm struggling to get a window
on screen
as SDL_CreateWindow is failing, here's what I've got:
try{
DerelictSDL2.load();
}catch(Exception e){
writeln("F
18 matches
Mail list logo