On 06/13/2014 10:29 PM, Meta wrote:
I thought this was possible, but DMD 2.065 doesn't allow it, saying no
constructor for int:
int* p = new int(3);
Is something like this planned for the future? I know we can already do:
int n = int(3);
Those both compile with 2.066
Ali
On Saturday, 14 June 2014 at 06:39:56 UTC, Ali Çehreli wrote:
On 06/13/2014 10:29 PM, Meta wrote:
I thought this was possible, but DMD 2.065 doesn't allow it,
saying no
constructor for int:
int* p = new int(3);
Is something like this planned for the future? I know we can
already do:
int n
Would
auto i = (int*)(3);
make sense?
Does it work?
On Sat, 14 Jun 2014 01:24:03 +
Mike Franklin via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
In other words, is 'shared __gshared' redundant?
Redundant? Not exactly.
__gshared makes it so that the variable is treated like a C variable - it's
not in TLS - but its _type_ is
On Saturday, 14 June 2014 at 08:09:12 UTC, Philippe Sigaud via
Digitalmars-d-learn wrote:
Would
auto i = (int*)(3);
make sense?
Does it work?
No:
Error: C style cast illegal, use cast(int*)3
And I don't think it should, because the heap allocation that
you're probably expecting should be
On Friday, 13 June 2014 at 22:12:01 UTC, Ali Çehreli wrote:
On 06/13/2014 03:02 PM, monarch_dodra wrote:
No, it just receives a range, so it does range formating. eg:
[ ~ Element ~ , ~ Element ... ].
It still looks like it could send the formatting characters as
well as the elements
On 06/14/2014 03:58 AM, Reuben wrote:
Hi,
I'm new to D and am trying to compile a simple hello world program.
I get the following error when compiling it:
dmd test.d
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld:
That really is it. The other methods are just other gets to the
buffer, like this:
T[] get_dup(TS strat=TS.cyclic)(size_t n) const {
static if (strat==TS.once) size_t numreads = fixNToFill(n);
else size_t numreads = n;
auto ret = new T[](numreads);
One stupid question: in Python subclassing of Exception looks
like:
class MyError(Exception): pass
but in D, if I'm right, we should write more code:
class MyError : Exception {
this(string msg) { super(msg); }
}
(without constructor we get error: ...Cannot implicitly generate
a
On Saturday, 14 June 2014 at 10:45:25 UTC, Mike Wey wrote:
On 06/14/2014 03:58 AM, Reuben wrote:
Hi,
I'm new to D and am trying to compile a simple hello world
program.
I get the following error when compiling it:
dmd test.d
And I don't think it should, because the heap allocation that you're
probably expecting should be explicit IMO. For me it's also unintuitive,
because I would read it as constructing a pointer that points to the address
3.
I agree. I'm trying to get a feel on the limits of this new
Paul:
class MyError : Exception {
this(string msg) { super(msg); }
}
Don't call exceptions errors, because in D there are also errors,
so they should have distinct names.
Is any shorter D way?
Perhaps not.
Bye,
bearophile
On Saturday, 14 June 2014 at 11:59:53 UTC, Paul wrote:
One stupid question: in Python subclassing of Exception looks
like:
class MyError(Exception): pass
but in D, if I'm right, we should write more code:
class MyError : Exception {
this(string msg) { super(msg); }
}
(without
On Saturday, 14 June 2014 at 12:17:46 UTC, FreeSlave wrote:
On Saturday, 14 June 2014 at 11:59:53 UTC, Paul wrote:
One stupid question: in Python subclassing of Exception looks
like:
class MyError(Exception): pass
but in D, if I'm right, we should write more code:
class MyError : Exception {
On 06/14/2014 02:01 PM, Reuben wrote:
On Saturday, 14 June 2014 at 10:45:25 UTC, Mike Wey wrote:
On 06/14/2014 03:58 AM, Reuben wrote:
Depending on the desired behavior you'll need to remove the -shared
flag from the configuration or add -defaultlib=:libphobos2.so
dmd.conf contains the
Hi,
I'm new to D and stumbled upon this very interesting discussion.
My question now is:
can you provide an example of how to return a collection of
homogeneous elements whose size is not known at compile time (for
wich you would normally use a dynamic array) from a function?
Thanks,
Marco
I get a failure on a test in format.d when I build my own project with
unittest. I though importing phobos header would not regenerate their
unittest modules.
Any idea of what can cause this issue? I already have reinstalled dmd
with visualD completely.
On Saturday, 14 June 2014 at 13:05:52 UTC, Mike Wey wrote:
On 06/14/2014 02:01 PM, Reuben wrote:
On Saturday, 14 June 2014 at 10:45:25 UTC, Mike Wey wrote:
On 06/14/2014 03:58 AM, Reuben wrote:
Depending on the desired behavior you'll need to remove the
-shared
flag from the configuration
On Saturday, 14 June 2014 at 14:02:52 UTC, Marco Cosentino wrote:
Hi,
I'm new to D and stumbled upon this very interesting discussion.
My question now is:
can you provide an example of how to return a collection of
homogeneous elements whose size is not known at compile time
(for
wich you
On Monday, 9 June 2014 at 15:54:21 UTC, Ivan Kazmenko wrote:
I'd expect a multiple overrides of same function error, much
like if I just paste the mixin code by hand. Is that a bug or
working by design? In the latter case, please explain the
reasoning.
http://dlang.org/template-mixin.html
int[] data = [1,2,3,4];// create new array on the
heap
Thanks for the answer.
This is the bit of information I was missing: how to create an
array in the heap.
Is also this a valid way to do so?
int[] data = new int[0];
data ~= [4,2,3,1];
On Saturday, 14 June 2014 at 21:37:51 UTC, Marco Cosentino wrote:
int[] data = [1,2,3,4];// create new array on the
heap
Thanks for the answer.
This is the bit of information I was missing: how to create an
array in the heap.
Is also this a valid way to do so?
int[] data = new
On Sat, 14 Jun 2014 11:59:52 +
Paul via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
One stupid question: in Python subclassing of Exception looks
like:
class MyError(Exception): pass
but in D, if I'm right, we should write more code:
class MyError : Exception {
I've bumped up against this cryptic error from time to time. I
can't really pin it down to a simple self contained example as it
tends to come up when I try to have template-heavy modules
interact and there is a lot to untangle.
I can't see the pattern in my code that triggers the assertion
On Sun, Jun 15, 2014 at 04:44:06AM +, Vlad Levenfeld via
Digitalmars-d-learn wrote:
I've bumped up against this cryptic error from time to time. I can't really
pin it down to a simple self contained example as it tends to come up when I
try to have template-heavy modules interact and there
Update and clarification:
this triggers the error:
flight_info.add (Plot (ts.zip (vs), gfx, txt)
.color (blue*white)
.title (`velocity`)
, square (0.15)
);
this compiles:
flight_info.add (Plot (ts.zip (vs), gfx, txt), square (0.15));
this also compiles:
auto plot = Plot
I had not heard of this tool before. This looks like it's going
to be very handy, thank you!
I'd also like to note that elsewhere in my code (in a unittest to
be precise), I am using the full functionality of the Plot struct
with no hiccups...
info.add (
Plot (ℕ!24.map!(i = 0.8*i)
.map!(x = τ(x, sin (x^^2))),
gfx, txt)
.title (`testing`)
28 matches
Mail list logo