On 01/17/2014 01:28 PM, Kelet wrote:
> create a Task[2]. Once the Task is created, use the executeInNewThread
> function. You can use yieldForce to wait on it.
That's what I thought initially as well but then I realized that it can
be even simpler than that:
import std.stdio;
import std.paral
On Fri, 17 Jan 2014 13:10:00 +, Kagamin wrote:
I only noticed that rename uses MOVEFILE_REPLACE_EXISTING flag, which
can't be used with directories. Are you sure remove fails too? If
rename throws, remove is not called in your code.
Well, as a matter of fact I did try to use remove directly
On 2014-01-17 22:14, H. S. Teoh wrote:
Is that because D doesn't have implicit casting via opCast? -- because,
conceivably, if
x = d.abc;
gets lowered to
x = d.opCast!(typeof(x))(d.abc);
then the above can be made to work.
I don't know, maybe.
--
/Jacob Car
On Friday, 17 January 2014 at 21:07:46 UTC, Mineko wrote:
Today I'm asking a more theoretical question, since I can't
quite grasp this one too well.
Let's say I want 3 while-loops running in parallel, without
getting in the way of each other, how would I do that?
With std.parallel of course,
On Fri, Jan 17, 2014 at 09:08:50PM +0100, Jacob Carlborg wrote:
> On 2014-01-17 18:49, H. S. Teoh wrote:
>
> >Now I'm not sure if Variant allows assignment to a static type, but
> >in theory this should be possible:
> >
> > // assume d.abc returns a Variant
> > int x = d.abc; // will asser
On Friday, 17 January 2014 at 21:07:46 UTC, Mineko wrote:
Let's say I want 3 while-loops running in parallel, without
getting in the way of each other, how would I do that?
On the same set of data? That's optimistic if one of the loops
writes :) Otherwise, you could just create three tasks, o
Today I'm asking a more theoretical question, since I can't quite
grasp this one too well.
Let's say I want 3 while-loops running in parallel, without
getting in the way of each other, how would I do that?
With std.parallel of course, but that's where I get confused,
perhaps someone could en
On 2014-01-17 18:49, H. S. Teoh wrote:
Now I'm not sure if Variant allows assignment to a static type, but in
theory this should be possible:
// assume d.abc returns a Variant
int x = d.abc; // will assert if d.abc doesn't hold an int at runtime
It doesn't work. Variant doesn'
I think this is what you are looking for:
http://dlang.org/changelog.html#import_package
What an odd place to put it..
Too bad, it doesn't mention anything about calling the functions
like in my example, and why some do/don't work. I'd hoped for
more.
On Fri, Jan 17, 2014 at 07:08:54PM +, Tobias Pankrath wrote:
> >I can store properties of type A, B and C but when i retrieve them
> >they all come back as A because of array covariance. I wonder if
> >there is a way of casting them automagically to the correct type.
>
> So you basically want
On Fri, Jan 17, 2014 at 06:49:25PM +, Gary Willoughby wrote:
[...]
> In the example in my original post the types are known at compile
> time but they are different between properties. I wondered if there
> was a solution to storing and retrieving while preserving the
> original type via opDisp
I can store properties of type A, B and C but when i retrieve
them they all come back as A because of array covariance. I
wonder if there is a way of casting them automagically to the
correct type.
So you basically want to declare a classmember for every name
opDispatch is called with? That i
On Wednesday, 15 January 2014 at 21:00:57 UTC, Jeroen Bollen
wrote:
How do you correctly create a MersenneTwisterEngine with a
ulong as seed?
This question still isn't answered by the way.
On Friday, 17 January 2014 at 17:50:54 UTC, H. S. Teoh wrote:
On Fri, Jan 17, 2014 at 05:29:14PM +, Gary Willoughby wrote:
On Friday, 17 January 2014 at 15:56:46 UTC, H. S. Teoh wrote:
>Couldn't you just return a Variant? I thought this is what
>Variants
>are made for.
>
>
>T
Yes but then
On Fri, Jan 17, 2014 at 05:29:14PM +, Gary Willoughby wrote:
> On Friday, 17 January 2014 at 15:56:46 UTC, H. S. Teoh wrote:
> >Couldn't you just return a Variant? I thought this is what Variants
> >are made for.
> >
> >
> >T
>
> Yes but then i would need to coerce it to get it's underlying ty
On Friday, 17 January 2014 at 15:56:46 UTC, H. S. Teoh wrote:
Couldn't you just return a Variant? I thought this is what
Variants are
made for.
T
Yes but then i would need to coerce it to get it's underlying
type.
On Thursday, 16 January 2014 at 15:46:01 UTC, Lemonfiend wrote:
The following behavior seems odd to me. Could anyone explain
why it works as it does? (Does package.d have a page on
dlang.org?)
--- main.d
module main;
void main()
{
test1();
test2();
}
void test1()
{
im
Another small reason is to enforce decoupling between required
code and the rest of the library. Back when Phobos was all one
library, half the library was compiled into every program. The
runtime writes to stderr, the IO package relies on other
modules... Kind of like what happens now if you
On Fri, Jan 17, 2014 at 08:56:18AM +0100, Jacob Carlborg wrote:
> On 2014-01-16 21:26, Gary Willoughby wrote:
> >What i would like to achieve is to dynamically assign and retrieve
> >properties without declaring them first. For example:
> >
> >class T
> >{
> > public this()
> > {
> >
On 2014-01-17 15:29, Andrea Fontana wrote:
I think it would be useful to put full path on __FILE__ or to add
another constant. Anyone?
I agree. Probably safest to add a new constant, to avoid breaking code.
--
/Jacob Carlborg
On Friday, 17 January 2014 at 10:48:33 UTC, Jacob Carlborg wrote:
On 2014-01-17 10:50, Andrea Fontana wrote:
Hmm I thought It can be done reading __FILE__ at compile-time,
but it
gives me just the relative path.
Right, forgot about __FILE__.
I think it would be useful to put full path on __
I only noticed that rename uses MOVEFILE_REPLACE_EXISTING flag,
which can't be used with directories. Are you sure remove fails
too? If rename throws, remove is not called in your code.
On Fri, 17 Jan 2014 07:07:35 +, Kagamin wrote:
Does it fail for that one directory only or for any directory?
Interesting question. I would have to do more tests with odd names, but
apparently both remove() and rename() have problems with directories
with a blank name.
Curiously, moving f
On Saturday, 4 February 2012 at 06:45:08 UTC, H. S. Teoh wrote:
On Fri, Feb 03, 2012 at 10:18:18PM -0800, H. S. Teoh wrote:
Why does the following code give a compiler error?
static int[string] table = ["abc":1, "def":2, "ghi":3];
Error message is:
prog.d:3: Error: non-constant expre
On 2014-01-17 10:50, Andrea Fontana wrote:
Hmm I thought It can be done reading __FILE__ at compile-time, but it
gives me just the relative path.
Right, forgot about __FILE__.
--
/Jacob Carlborg
Hmm I thought It can be done reading __FILE__ at compile-time,
but it gives me just the relative path.
Recent topic here:
http://forum.dlang.org/thread/meuyppazxkrjcbgmk...@forum.dlang.org
On Friday, 17 January 2014 at 09:29:48 UTC, Jacob Carlborg wrote:
On 2014-01-17 10:23, Andrea Fontana
On 2014-01-17 10:23, Andrea Fontana wrote:
thisExePath "returns the full path of the current executable".
If I run something like "./mysource.d" (using rdmd shebang) it returns
the full path to compiled executable in /tmp folder (not so useful I
think!). Is there a way to have the path of source
thisExePath "returns the full path of the current executable".
If I run something like "./mysource.d" (using rdmd shebang) it
returns the full path to compiled executable in /tmp folder (not
so useful I think!). Is there a way to have the path of source
itself?
On 2014-01-16 21:26, Gary Willoughby wrote:
What i would like to achieve is to dynamically assign and retrieve
properties without declaring them first. For example:
class T
{
public this()
{
this.foo = "bar";
}
}
Ordinarily the above won't compile because 'foo' hasn't be
29 matches
Mail list logo