Awesome... it works!-Eric
Original Message
Subject: Re: enum question
From: Ali Çehreli
Date: Tue, March 18, 2014 3:51 pm
To: digitalmars-d-learn@puremagic.com
On 03/18/2014 01:40 PM, Eric wrote:
> Apparently you can't pass an enum as a reference,
It is
This Rosettacode code task (in two different D versions) seems to
show some D/Phobos regressions (or just some problems):
http://rosettacode.org/wiki/Parallel_calculations#D
In the second version (that works with dmd 2.066alpha) I have had
to comment out the pure nothrow here, despite this use
On Tuesday, 18 March 2014 at 23:33:12 UTC, bearophile wrote:
Chris Williams:
But I also like to know how most-effectively to write a
C-style macro in D, so it seemed worth checking what the state
of the art is.
This is an antipattern :-)
Bye,
bearophile
As are goto, pointers, and conditio
Does GDC and/or LDC have sparc solaris backend support?
I'm trying to make my company use D and we have a bunch of legacy
machines that unfortunately run on sparc-solaris 2.10.
/Per
Chris Williams:
But I also like to know how most-effectively to write a C-style
macro in D, so it seemed worth checking what the state of the
art is.
This is an antipattern :-)
Bye,
bearophile
On Tuesday, 18 March 2014 at 23:10:05 UTC, Chris Williams wrote:
Annoying that formatting the string is required. I think you're
right that it's ignoring my alias parameter because I'm not
using it. Formatting doesn't accomplish anything except to use
the parameter. But in exchange, you have to
On Tuesday, 18 March 2014 at 23:05:51 UTC, bearophile wrote:
Chris Williams:
I could put a wrapper around the calls to these functions that
performs this action, but I figured a little macro would be
sufficient for my needs (it's just a little script.)
I suggest to keep the code simpler.
By
On Tuesday, 18 March 2014 at 22:42:20 UTC, anonymous wrote:
You can pass the variable name as a string:
Or you can get the variable name from the alias parameter:
import std.string: format;
template gotoPath(alias path) {
enum gotoPath = format(q{
...
Chris Williams:
I could put a wrapper around the calls to these functions that
performs this action, but I figured a little macro would be
sufficient for my needs (it's just a little script.)
I suggest to keep the code simpler.
Bye,
bearophile
On 03/18/2014 01:40 PM, Eric wrote:
> Apparently you can't pass an enum as a reference,
It is possible as seen in the following code.
> I have read on this forum that someday enums may be able to be
> made with class elements.
Someday is today! :)
class C
{
int i;
this(int i)
{
On Tuesday, 18 March 2014 at 21:56:32 UTC, Chris Williams wrote:
import fs = std.file;
import std.stdio;
template gotoPath(alias path) {
enum gotoPath = q{
string currPath = fs.getcwd();
scope (exit) fs.chdir(currPath);
fs.chdir(path);
};
This is just a string.
I have a series of functions that each needs to change directory,
perform an action, and then revert to the original working
directory.
I could put a wrapper around the calls to these functions that
performs this action, but I figured a little macro would be
sufficient for my needs (it's just
On Tuesday, 18 March 2014 at 20:56:45 UTC, Adam D. Ruppe wrote:
On Tuesday, 18 March 2014 at 20:40:36 UTC, Eric wrote:
However, using struct type seems inefficient because structs
are pass by value.
That's not necessarily a problem, especially if the struct is
small, passing by value is faste
On Tuesday, 18 March 2014 at 20:40:36 UTC, Eric wrote:
However, using struct type seems inefficient because structs
are pass by value.
That's not necessarily a problem, especially if the struct is
small, passing by value is faster than by reference.
What is your code trying to do?
Can enums
I would like to use enums with elements that are either a struct
type
or a class type. However, using struct type seems inefficient
because
structs are pass by value. Apparently you can't pass an enum as
a reference,
so eliminating the pass by value for enums does not seem
possible. I have
On Tuesday, 18 March 2014 at 19:18:23 UTC, anonymous wrote:
See the rest of my message.
Right, I was afraid this was the case.
On Tuesday, 18 March 2014 at 18:58:04 UTC, Meta wrote:
On Tuesday, 18 March 2014 at 17:38:26 UTC, anonymous wrote:
[...]
Since left and right are alias parameters, you need "alias" in
the is expression, too:
---
if (is(P == Pair!(left, right), alias left, alias right)
&& /* etc */)
---
Ye
On Tuesday, 18 March 2014 at 17:38:26 UTC, anonymous wrote:
On Tuesday, 18 March 2014 at 16:02:26 UTC, Meta wrote:
I'd like to have the arguments of the template parameter list
of an is-expression to be visible outside that is-expression,
but I can't figure out a way to get an alias to them. Is
I can now confirm that the part of the document
http://dlang.org/dll-linux.html
about loading D dynamic libraries from a D main program is
experimentally apparently correct with a real world largish
executable.
The machinery to initialize the runtime in the dynamic library
in
http://stackove
On 03/18/2014 10:44 AM, anonymous wrote:
On Tuesday, 18 March 2014 at 17:07:01 UTC, Ali Çehreli wrote:
On 03/18/2014 09:02 AM, Meta wrote:
[...]
struct Pair(alias left, alias right) {}
template Left(P)
if (is(P == Pair!(left, right), left, right)
&& is(typeof(left) == int)
&& is(typeo
On Tuesday, 18 March 2014 at 17:07:01 UTC, Ali Çehreli wrote:
On 03/18/2014 09:02 AM, Meta wrote:
[...]
struct Pair(alias left, alias right) {}
template Left(P)
if (is(P == Pair!(left, right), left, right)
&& is(typeof(left) == int)
&& is(typeof(right) == int))
Too many typeofs there
On Tuesday, 18 March 2014 at 16:02:26 UTC, Meta wrote:
I'd like to have the arguments of the template parameter list
of an is-expression to be visible outside that is-expression,
but I can't figure out a way to get an alias to them. Is
something like this possible?
struct Pair(alias left, ali
On 03/18/2014 09:02 AM, Meta wrote:
I'd like to have the arguments of the template parameter list of an
is-expression to be visible outside that is-expression, but I can't
figure out a way to get an alias to them. Is something like this possible?
struct Pair(alias left, alias right) {}
template
I'd like to have the arguments of the template parameter list of
an is-expression to be visible outside that is-expression, but I
can't figure out a way to get an alias to them. Is something like
this possible?
struct Pair(alias left, alias right) {}
template Left(P)
if (is(P == Pair!(left, r
On Tuesday, 18 March 2014 at 07:20:05 UTC, Jacob Carlborg wrote:
On Tuesday, 18 March 2014 at 07:19:05 UTC, Jacob Carlborg wrote:
What exact problems do you have?
Note that SWT is not thread safe. All UI changes need to be
made on the UI thread. This is usually done using the
"Display.asyncE
On Tuesday, 18 March 2014 at 08:54:50 UTC, Spacen Jasset wrote:
On Monday, 17 March 2014 at 20:39:45 UTC, anonymous wrote:
On Monday, 17 March 2014 at 09:18:36 UTC, Spacen Jasset wrote:
While trying to use dirEntries range with foreach I
encountered a seemingly unsurmountable problem. The probl
On Monday, 17 March 2014 at 20:39:45 UTC, anonymous wrote:
On Monday, 17 March 2014 at 09:18:36 UTC, Spacen Jasset wrote:
While trying to use dirEntries range with foreach I
encountered a seemingly unsurmountable problem. The problem is
that an execption is thrown while calling .front() on the
On Tuesday, 18 March 2014 at 07:19:05 UTC, Jacob Carlborg wrote:
What exact problems do you have?
Note that SWT is not thread safe. All UI changes need to be
made on the UI thread. This is usually done using the
"Display.asyncExec" method.
Forgot the link to the example:
http://git.eclipse.
On Monday, 17 March 2014 at 23:16:16 UTC, Sharad Gupta wrote:
Hi All,
I am trying to update a text box from another thread but it has
me stumped right now.
What I am trying to achieve is that the user can Initiate
multiple pipeShell and the output from each of those should go
into its own T
29 matches
Mail list logo