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
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-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
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: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
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 expression
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
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 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
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 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()
{
this.foo =
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 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()
{
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 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 type.
But
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 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 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
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 to
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 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
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
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,
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 assert if d.abc
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
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
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
27 matches
Mail list logo