On Thursday, 5 April 2018 at 04:48:02 UTC, Basile B. wrote:
On Wednesday, 4 April 2018 at 21:00:44 UTC, solidstate1991
wrote:
void main()
{
import std.stdio;
(new Foo).foo(0,0).writeln;
}
```
Ah sorry, the params must be removed ((new Foo).foo().writeln;)...
I was actually trying to
On Wednesday, 4 April 2018 at 21:00:44 UTC, solidstate1991 wrote:
I have this code:
asm @nogc{
movqXMM0, xy;
paddd XMM0, sXY; // xy + sXY
movqXMM3, xy0;
psubd XMM0, XMM3; // xy + sXY - x0y0
movq
On Wednesday, April 04, 2018 21:46:13 Timoses via Digitalmars-d-learn wrote:
> On Wednesday, 4 April 2018 at 18:11:12 UTC, Jonathan M Davis
> > That code doesn't compile - at least not with dmd master. It
> > gives these two errors:
> >
> > q.d(5): Error: constructor `q.A.this` missing initializer
On Wednesday, 4 April 2018 at 20:01:55 UTC, Ali wrote:
On Wednesday, 4 April 2018 at 19:51:27 UTC, kdevel wrote:
On Wednesday, 4 April 2018 at 19:19:30 UTC, Ali wrote:
BTW: You can't write
void main ()
{
x.writeln;
int x;
}
import std.stdio;
This is because x is not
On Tuesday, 3 April 2018 at 19:02:25 UTC, Vladimirs Nordholm
wrote:
Hello people.
I currently have a function which multiple times per second
takes in arguments, and appends the argument as my special
type. The following code should explain what I do more properly:
struct MySpecialType
On Wednesday, 4 April 2018 at 16:16:24 UTC, Alex wrote:
Here is something:
https://dlang.org/spec/class.html#constructors
By the rules 7 and 8 it is suggested, what Simen already said,
the construction of the base class can be independent from the
derived one. And as such, the immutability
On Wednesday, 4 April 2018 at 18:11:12 UTC, Jonathan M Davis
wrote:
On Wednesday, April 04, 2018 16:05:52 Timoses via
```
class A
{
immutable int i;
this(){}
}
class B : A
{
this()
{
this.i = 3;
super(); // <- specifically calling
I forgot to tell, that xy0 ac, and bd are local to the class.
I have this code:
asm @nogc{
movqXMM0, xy;
paddd XMM0, sXY; // xy + sXY
movqXMM3, xy0;
psubd XMM0, XMM3; // xy + sXY - x0y0
movqXMM1, ac;
movqXMM2, bd;
pmuludq
On Wednesday, 4 April 2018 at 19:51:27 UTC, kdevel wrote:
On Wednesday, 4 April 2018 at 19:19:30 UTC, Ali wrote:
On Wednesday, 4 April 2018 at 18:57:27 UTC, kdevel wrote:
[...]
I think the rules should have been the same everywhere
and if there was an exception to be made, it could be made for
On Wednesday, 4 April 2018 at 19:51:27 UTC, kdevel wrote:
On Wednesday, 4 April 2018 at 19:19:30 UTC, Ali wrote:
BTW: You can't write
void main ()
{
x.writeln;
int x;
}
import std.stdio;
This is because x is not module scope
you can do this
void main ()
{
On Wednesday, 4 April 2018 at 19:10:33 UTC, greatsam4sure wrote:
I am have problem setting up libuid on windows 10.
These are the errors thus far:
[...]
How do you call the compiler?
Make sure you pass all the libraries etc. to dmd when you compile.
On Wednesday, 4 April 2018 at 19:19:30 UTC, Ali wrote:
On Wednesday, 4 April 2018 at 18:57:27 UTC, kdevel wrote:
[...]
I think the rules should have been the same everywhere
and if there was an exception to be made, it could be made for
the main function
since the main function is special
On Wednesday, 4 April 2018 at 18:57:27 UTC, kdevel wrote:
Why are people writing
import std.stdio;
void main ()
{
}
struct S {
}
but not
void main ()
{
}
struct S {
}
import std.stdio;
?
Personally i found it weird and inconsistent that
I am have problem setting up libuid on windows 10.
These are the errors thus far:
C:\Users\Greatsam\Desktop\HelloApp>dub
Fetching libuid 0.0.7 (getting selected version)...
Performing "debug" build using dmd for x86.
libuid 0.0.7: building configuration "lib"...
helloapp ~master: building
Why are people writing
import std.stdio;
void main ()
{
S s;
s.foo;
}
struct S {
void foo ()
{
writeln ("a");
}
}
but not
void main ()
{
S s;
s.foo;
}
struct S {
void foo ()
{
writeln
On Wednesday, 4 April 2018 at 15:44:34 UTC, Steven Schveighoffer
wrote:
See my original post:
I know I can do things like this:
void foo(int x) { return foo(nullable(x)); }
-Steve
Oops, I read only the body of that function and thought it's a
main function constructiong nullable when
On Wednesday, April 04, 2018 16:05:52 Timoses via Digitalmars-d-learn wrote:
> On Wednesday, 4 April 2018 at 10:41:52 UTC, Simen Kjærås wrote:
> > Because by the time B's constructor is called, A might already
> > have initialized it, and rely on it never changing.
>
> What about:
>
> ```
> class
On Wednesday, 4 April 2018 at 16:05:52 UTC, Timoses wrote:
This becomes a bit hideous, unfortunately, when there are many
initializations involved.
Found this, but it doesn't mention anything about derived
classes..
https://dlang.org/spec/class.html#field-init
Here is something:
On Wednesday, 4 April 2018 at 10:41:52 UTC, Simen Kjærås wrote:
Because by the time B's constructor is called, A might already
have initialized it, and rely on it never changing.
What about:
```
class A
{
immutable int i;
this(){}
}
class B : A
{
this()
{
this.i = 3;
On Wednesday, 4 April 2018 at 15:57:19 UTC, Simen Kjærås wrote:
On Wednesday, 4 April 2018 at 15:49:31 UTC, Vladimirs Nordholm
wrote:
if (is(T == A) || is(T == B) || is(T == Enum))
if (is(T : Enum))
--
Simen
Ah! Thanks a lot!
On Wednesday, 4 April 2018 at 15:49:31 UTC, Vladimirs Nordholm
wrote:
private template Mix()
{
this(Enum ee) { e = ee; }
Enum e;
alias this = e;
}
Oops, typo in the alias. Should be `alias e this`
On Wednesday, 4 April 2018 at 15:49:31 UTC, Vladimirs Nordholm
wrote:
if (is(T == A) || is(T == B) || is(T == Enum))
if (is(T : Enum))
--
Simen
On Tuesday, 3 April 2018 at 20:41:01 UTC, Alex wrote:
On Tuesday, 3 April 2018 at 20:02:46 UTC, Vladimirs Nordholm
wrote:
On Tuesday, 3 April 2018 at 19:53:11 UTC, Meta wrote:
[...]
I don't think I know the size of the arguments.
If I pass in "123" and MySpecialType('a'), the result should
Hello people from D-land.
Short question: Can get the type of a struct that has `alias this
= ` ?
See this example, where a struct is aliased to an enum:
enum Enum { one, two, three, fourtytwo }
private template Mix()
{
this(Enum ee) { e = ee; }
Enum e;
On 4/4/18 8:59 AM, Dukc wrote:
Is this what you're looking for?
See my original post:
I know I can do things like this:
void foo(int x) { return foo(nullable(x)); }
-Steve
On Wednesday, 4 April 2018 at 05:28:57 UTC, Carlos Navarro wrote:
As a newbie in D (and making a lots of mistakes), I've found
myself relying heavily in the use of a rudimentary type
inspector to visualize my templated code instantiations.
It's simple and incomplete as hell but good enough to
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer
wrote:
But I'd rather avoid such things if possible. Is there a way
around this? Seems rather limiting that I can do:
Is this what you're looking for?
void foo(Nullable!int x = Nullable!int.init)
{ if (!x.isNull) x.get.writeln;
On Wednesday, 4 April 2018 at 10:09:41 UTC, sarn wrote:
On Wednesday, 4 April 2018 at 10:00:18 UTC, Orfeo wrote:
foreach (l; log) {
l.run;
}
Try making this "foreach (ref l; log) {".
Structs are value types in D, so by default they're copied when
you assign them to
On Wednesday, 4 April 2018 at 10:11:37 UTC, Timoses wrote:
Example:
```
class A
{
immutable int i;
this(){}
}
class B : A
{
this()
{
this.i = 3;
}
}
void main()
{
auto b = new B;
}
```
throws:
Error: constructor `onlineapp.A.this` missing initializer for
Example:
```
class A
{
immutable int i;
this(){}
}
class B : A
{
this()
{
this.i = 3;
}
}
void main()
{
auto b = new B;
}
```
throws:
Error: constructor `onlineapp.A.this` missing initializer for
immutable field i
Error: cannot modify immutable expression
On Wednesday, 4 April 2018 at 10:00:18 UTC, Orfeo wrote:
foreach (l; log) {
l.run;
}
Try making this "foreach (ref l; log) {".
Structs are value types in D, so by default they're copied when
you assign them to another variable (in this case l). That means
run() is
Hi all,
I have:
```
import std.stdio;
void main() {
Logger[] log;
Logger l0 = Logger(0,1);
Logger l1 = Logger(100,1);
Logger l2 = Logger(200,1);
log ~= l0;
log ~= l1;
foreach (i; 0 .. 3) {
writeln("it:", i);
foreach (l; log) {
l.run;
}
}
}
On Wednesday, 4 April 2018 at 08:08:40 UTC, Dejan Lekic wrote:
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer
wrote:
I currently have a situation where I want to have a function
that accepts a parameter optionally.
This is what function overloading and/or default values are
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer
wrote:
I currently have a situation where I want to have a function
that accepts a parameter optionally.
This is what function overloading and/or default values are for,
right?
35 matches
Mail list logo