On Monday, 23 January 2017 at 23:04:45 UTC, Ali Çehreli wrote:
On 01/23/2017 02:58 PM, bitwise wrote:
I'm confused about what the rules would be here.
It would make sense to call the postblit if present, but
std.Array
currently does not:
https://github.com/dlang/phobos/blob/04cca5c85ddf2be253
On Monday, 23 January 2017 at 12:13:30 UTC, albert-j wrote:
There's not much object creation going on there, mostly loops
over arrays, so I assume GC is not an issue.
When passing arrays around, beware that static arrays are value
types in D and are copied unless passed by reference.
On Monday, 23 January 2017 at 22:20:59 UTC, Ali Çehreli wrote:
On 01/23/2017 12:48 PM, Jon Degenhardt wrote:
[snip]
> So, what I'm really wondering is if there is built-in way
to get closer to:
outputStream.writefln(...);
If it's about formatted output then perhaps formattedWrite?
On 01/23/2017 02:58 PM, bitwise wrote:
I'm confused about what the rules would be here.
It would make sense to call the postblit if present, but std.Array
currently does not:
https://github.com/dlang/phobos/blob/04cca5c85ddf2be25381fc63c3e941498b17541b/std/container/array.d#L884
Post-blit is
On Monday, 23 January 2017 at 22:26:58 UTC, bitwise wrote:
Is it ok to memcpy/memmove a struct in D?
Quote from here:
https://dlang.org/spec/garbage.html
"Do not have pointers in a struct instance that point back to
the same instance. The trouble with this is if the instance
gets moved in mem
I'm confused about what the rules would be here.
It would make sense to call the postblit if present, but
std.Array currently does not:
https://github.com/dlang/phobos/blob/04cca5c85ddf2be25381fc63c3e941498b17541b/std/container/array.d#L884
On Monday, 23 January 2017 at 12:13:30 UTC, albert-j wrote:
Well it is actually ODE solver from Numerical recipes
(originally in C++) that I am trying to do in D. Code
translation seems very straightforward. Maybe there's someone
around who has done that already? There's not much object
creati
Is it ok to memcpy/memmove a struct in D?
Quote from here:
https://dlang.org/spec/garbage.html
"Do not have pointers in a struct instance that point back to the
same instance. The trouble with this is if the instance gets
moved in memory, the pointer will point back to where it came
from, wit
On 01/23/2017 12:48 PM, Jon Degenhardt wrote:
On Monday, 23 January 2017 at 08:03:14 UTC, Ali Çehreli wrote:
On 01/22/2017 01:54 PM, Jon Degenhardt wrote:
I've been increasingly using output ranges in my code (the "component
programming" model described in several articles on the D site). It
wo
On Monday, 23 January 2017 at 08:03:14 UTC, Ali Çehreli wrote:
On 01/22/2017 01:54 PM, Jon Degenhardt wrote:
I've been increasingly using output ranges in my code (the
"component
programming" model described in several articles on the D
site). It
works very well, except that it would often be m
On Monday, 23 January 2017 at 15:15:35 UTC, aberba wrote:
I'm creating a function to authenticate user login. I want to
determine login failure (Boolean) and error message (will be
sent to frontend) but D does have multiple return type
[...]
Yes, MRV can be done with a tuple
auto foo()
{
On Monday, 23 January 2017 at 15:15:35 UTC, aberba wrote:
I'm creating a function to authenticate user login. I want to
determine login failure (Boolean) and error message (will be
sent to frontend) but D does have multiple return type (IMO
could use struct but will make code dirty with too muc
On Monday, 23 January 2017 at 15:24:09 UTC, aberba wrote:
Unless you will be limited by tge limitations of C. Vala
programming language has that issue even though they utilize
GObject
What limitations? C/C++ programs go around "limitations" by using
compiler extensions and runtime libraries.
On Monday, 23 January 2017 at 14:40:18 UTC, Ola Fosheim Grøstad
wrote:
On Saturday, 21 January 2017 at 19:30:31 UTC, Jack Stouffer
wrote:
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote:
Hi friends,
Is there a way to "compile" d code to C, similar to what nim
does?
That would be
I'm creating a function to authenticate user login. I want to
determine login failure (Boolean) and error message (will be sent
to frontend) but D does have multiple return type (IMO could use
struct but will make code dirty with too much custom types).
struct Result
{
bool success = false
On Monday, 23 January 2017 at 14:53:54 UTC, Bauss wrote:
I'd guess the code generation you'd get from doing so with D
would be absolute horrific to read, because you'll get rid of
CTFE, templates, proper class structure, globals properly
stored, since everything in D is TLS and C doesn't then y
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote:
Hi friends,
Is there a way to "compile" d code to C, similar to what nim
does?
That would be cool for greater portability.
Nim is able to, because Nim doesn't really compile. The Nim
compiler just translates Nim code to C code and
On Saturday, 21 January 2017 at 19:30:31 UTC, Jack Stouffer wrote:
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote:
Hi friends,
Is there a way to "compile" d code to C, similar to what nim
does?
That would be cool for greater portability.
No, and this is actually a terrible idea
On Monday, 23 January 2017 at 13:57:23 UTC, aberba wrote:
if (stu is Student.init) //will confirm when i get to my pc
That works, as does this:
if(stu == Student.init)
Structs are a value type and will always have a type that won't be null.
If you want it to be nullable you will have to use pointers or classes
(there is also Nullable in std.typecons but it won't work with is null).
s/have a type that won't be null/have a value that won't be null/
My bad.
On 24/01/2017 2:57 AM, aberba wrote:
How do I verify this struct has no value
Student getStudent()
{
...
Student s;
if(condition) s = Student;
return s;
}
auto stu = getStudent();
//which will work and is best?
if (stu is null) //doesn't wrk.
if (stu is Student.init) //will con
How do I verify this struct has no value
Student getStudent()
{
...
Student s;
if(condition) s = Student;
return s;
}
auto stu = getStudent();
//which will work and is best?
if (stu is null) //doesn't wrk.
if (stu is Student.init) //will confirm when i get to my pc
Or how would
Without seeing the source there is nothing we can do.
Usually performant d-code looks quite diffrent from java code.
For example to avoid the gc :)
Well it is actually ODE solver from Numerical recipes (originally
in C++) that I am trying to do in D. Code translation seems very
straightforward
On Monday, 23 January 2017 at 11:11:21 UTC, albert-j wrote:
I have translated some simulation code from Java into D (a few
classes, mostly manipulation of double arrays in small
methods). D version runs 10-30% slower than Java (ldc2, dub
release build). Profiling did not show any obvious bottle
I have translated some simulation code from Java into D (a few
classes, mostly manipulation of double arrays in small methods).
D version runs 10-30% slower than Java (ldc2, dub release build).
Profiling did not show any obvious bottlenecks. I am wondering
whether I missed something, or such pe
On 01/22/2017 01:54 PM, Jon Degenhardt wrote:
I've been increasingly using output ranges in my code (the "component
programming" model described in several articles on the D site). It
works very well, except that it would often be more convenient to use
writeln style functions rather than 'put'.
26 matches
Mail list logo