I'm creating a minimal DRuntime (for messing around). Right now,
I have a very basic program that doesn't even link to the C
runtime, and uses syscalls for everything. I'm trying to
implement alloca so that I can parse arguments (long story), and
so I went to druntime/src/rt/alloca.d.
Everyth
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.
I thought maybe Nullable!int might work:
void foo(Nullable!int) {}
void main()
{
foo(1); // error
int x;
foo(x); // e
On Monday, 2 April 2018 at 09:31:35 UTC, Timoses 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.
I thought maybe Nullable!int might work:
void foo(Nullable!int) {}
vo
Hi all,
Let's say we have this code:
struct B
{
int a;
this(int a) immutable
{
this.a = 7;
}
this(int a)
{
this.a = 10;
}
}
void main()
{
B a = immutable B(2);
writeln(a.a);
a.a = 4;
immutable B a2 = immutable B(3);
writeln(a2.a)
On Monday, 2 April 2018 at 10:26:32 UTC, RazvanN wrote:
Hi all,
Let's say we have this code:
struct B
{
int a;
this(int a) immutable
{
this.a = 7;
}
this(int a)
{
this.a = 10;
}
}
void main()
{
B a = immutable B(2);
writeln(a.a);
a.a = 4
On Monday, 2 April 2018 at 11:41:55 UTC, Eduard Staniloiu wrote:
On Monday, 2 April 2018 at 10:26:32 UTC, RazvanN wrote:
[...]
The compiler does an implicit conversion from the type
`immutable B`
to the type `B`. It is able to do safely do so because `struct
B` has only
value types that can
On 4/1/18 12:00 PM, Jacob Carlborg wrote:
Yeah, D doesn't allow user defined implicit conversions, which I think
is required for this. I would make function overloading even more
complex than it is today.
Although it would be really handy for cases like this.
Not necessarily implicit con
On 4/2/18 5:31 AM, Timoses 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.
I thought maybe Nullable!int might work:
void foo(Nullable!int) {}
void main()
{
foo(1);
On 4/1/18 6:01 PM, Jonathan M Davis wrote:
On Sunday, April 01, 2018 11:54:16 Steven Schveighoffer via Digitalmars-d-
learn wrote:
I currently have a situation where I want to have a function that
accepts a parameter optionally.
I thought maybe Nullable!int might work:
void foo(Nullable!int) {
Heyo.
I have a struct with a couple "property" methods, like:
struct A
{
auto foo(int bar) { /* do something */ }
}
Is there any reason for me to add the @property tags for the
method? The following code compiles just fine with the struct
above
A a = A();
a.foo =
On Monday, 2 April 2018 at 13:57:14 UTC, Vladimirs Nordholm wrote:
Is there any reason for me to add the @property tags for the
method?
A list of things the @property tag does can be found here:
https://dlang.org/spec/function.html#property-functions
This behavior is particularly useful for ge
As a follow-up to
https://forum.dlang.org/post/jfgpngdudtprzznrc...@forum.dlang.org
I managed to put together the benchmark
https://github.com/nordlow/phobos-next/blob/fa3526b15c746bda50a195f4e492ab2de9c15287/benchmarks/allocators/source/app.d
which run (via ldc)
dub run --build=release-nobou
On Monday, 2 April 2018 at 14:20:49 UTC, Dennis wrote:
On Monday, 2 April 2018 at 13:57:14 UTC, Vladimirs Nordholm
wrote:
Is there any reason for me to add the @property tags for the
method?
A list of things the @property tag does can be found here:
https://dlang.org/spec/function.html#propert
On Monday, 2 April 2018 at 14:51:57 UTC, Vladimirs Nordholm wrote:
On Monday, 2 April 2018 at 14:20:49 UTC, Dennis wrote:
On Monday, 2 April 2018 at 13:57:14 UTC, Vladimirs Nordholm
wrote:
Is there any reason for me to add the @property tags for the
method?
A list of things the @property tag
On Monday, 2 April 2018 at 14:51:57 UTC, Vladimirs Nordholm wrote:
Do you think I should I omit the @property tag, if the only
wanted behaviour is to set a value (`foo.bar = "baz";`) ?
You're probably fine either way, it's mostly for making your
intention clear. Jonathan M Davis made a great e
On Mon, Apr 02, 2018 at 10:26:32AM +, RazvanN via Digitalmars-d-learn wrote:
> Hi all,
>
> Let's say we have this code:
>
> struct B
> {
> int a;
> this(int a) immutable
> {
> this.a = 7;
> }
>
> this(int a)
> {
> this.a = 10;
> }
> }
>
> void mai
On 3/30/18 4:31 PM, Per Nordlöw wrote:
I'm working on a graph database with tens of millions of small nodes
containing typically around 8-64 bytes of member data. Is there a faster
way of allocating many small class objects such as
class Node
{
// abstract members
}
class StrNode : Node
On 3/30/18 4:45 PM, Cym13 wrote:
On Friday, 30 March 2018 at 20:43:09 UTC, Cym13 wrote:
Hi, I've got the following code that takes a list of files as argument
and xor them together (demo example sufficient for that discussion).
[...]
Forgot to mention but I'm also quite annoyed at the need f
On Monday, 2 April 2018 at 18:22:43 UTC, Steven Schveighoffer
wrote:
You may be interested in this proposal, which was inspired by
trying to implement a reserve feature for AAs (requires a
similar mechanism).
https://issues.dlang.org/show_bug.cgi?id=17881
Ok, thanks. I'll push for it.
One
On 4/2/18 2:51 PM, Per Nordlöw wrote:
On Monday, 2 April 2018 at 18:22:43 UTC, Steven Schveighoffer wrote:
You may be interested in this proposal, which was inspired by trying
to implement a reserve feature for AAs (requires a similar mechanism).
https://issues.dlang.org/show_bug.cgi?id=17881
On Monday, 2 April 2018 at 18:33:25 UTC, Steven Schveighoffer
wrote:
On 3/30/18 4:45 PM, Cym13 wrote:
On Friday, 30 March 2018 at 20:43:09 UTC, Cym13 wrote:
Hi, I've got the following code that takes a list of files as
argument and xor them together (demo example sufficient for
that discussion
On 4/2/18 3:24 PM, Cym13 wrote:
On Monday, 2 April 2018 at 18:33:25 UTC, Steven Schveighoffer wrote:
On 3/30/18 4:45 PM, Cym13 wrote:
On Friday, 30 March 2018 at 20:43:09 UTC, Cym13 wrote:
Hi, I've got the following code that takes a list of files as
argument and xor them together (demo exampl
On Monday, 2 April 2018 at 19:45:31 UTC, Steven Schveighoffer
wrote:
On 4/2/18 3:24 PM, Cym13 wrote:
[...]
Well, it's tough, because you can compose ranges in infinite
ways. All you need to generate the warning is some code like
this:
[...]
That makes sense, thanks.
On Monday, 2 April 2018 at 14:52:34 UTC, Per Nordlöw wrote:
As a follow-up to
https://forum.dlang.org/post/jfgpngdudtprzznrc...@forum.dlang.org
[...]
Hi,
I am not completely sure how to solve this, but maybe we can find
some clues here [1].
It seems like we should use addRoot on the buffer
On Monday, 2 April 2018 at 20:43:01 UTC, Alexandru Jercaianu
wrote:
I am not completely sure how to solve this, but maybe we can
find some clues here [1].
It seems like we should use addRoot on the buffer returned by
GC.instance.allocate to keep it alive.
Then, we can use addRange on each node a
On 4/2/18 5:16 PM, Per Nordlöw wrote:
On Monday, 2 April 2018 at 20:43:01 UTC, Alexandru Jercaianu wrote:
I am not completely sure how to solve this, but maybe we can find some
clues here [1].
It seems like we should use addRoot on the buffer returned by
GC.instance.allocate to keep it alive.
T
On Saturday, 31 March 2018 at 16:08:36 UTC, lempiji wrote:
---
import rx;
auto firstWord = new BehaviorSubject!string("Change");
auto secondWord = new BehaviorSubject!string("me!");
auto bothWords = new BehaviorSubject!string("");
combineLatest!((a, b) => a ~ " " ~ b)(firstWord,
seco
For reference: https://en.cppreference.com/w/cpp/utility/optional
On Tuesday, 3 April 2018 at 02:10:09 UTC, helxi wrote:
For reference:
https://en.cppreference.com/w/cpp/utility/optional
Nullable!T would be the closest thing:
https://dlang.org/phobos/std_typecons.html#Nullable
I'm not sure how comparable they are though.
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])`, candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/utf.d(2713):
`std.utf.toUTF8(S)(S s) if (isInputRange!S && !isInfinite!S &&
isSomeChar!(ElementEnco
On Tuesday, 3 April 2018 at 02:31:15 UTC, Uknown wrote:
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])`, candidates are:
/dlang/dmd/linux/bin64/../../src/phob
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])`, candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/utf.d(2713):
`std.utf.toUTF8(S)(S s) if (is
On Tuesday, 3 April 2018 at 02:31:15 UTC, Uknown wrote:
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])`, candidates are:
/dlang/dmd/linux/bin64/../../src/phob
On Tuesday, 3 April 2018 at 02:46:51 UTC, Domain wrote:
On Tuesday, 3 April 2018 at 02:31:15 UTC, Uknown wrote:
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])
On Tuesday, 3 April 2018 at 02:46:51 UTC, Domain wrote:
On Tuesday, 3 April 2018 at 02:31:15 UTC, Uknown wrote:
On Tuesday, 3 April 2018 at 02:24:08 UTC, Domain wrote:
wchar[10] buffer;
toUTF8(buffer);
Error: template `std.utf.toUTF8` cannot deduce function from
argument types `!()(wchar[10])
35 matches
Mail list logo