On 2013-07-13 20:53, Leandro Motta Barros wrote:
Hey, thanks! This makes sense :-)
Am I now wondering... how safe, portable and future proof would this
be? If some future version of D implements a garbage collector capable
of moving objects around the heap, I could get in trouble, right?
Walte
I assume that you template ends up creating a dummy interface
though and this isn't really acceptable.
Yes, it does. Once ':' is typed, some inheritance must occur.
Why isn't a dummy interface acceptable?
On 2013-07-14, 07:00, JS wrote:
I need to conditionally inherit:
interface A(T) : conditionallyInherit!(isBasicType!T, B);
A!(double) will inherit B but A!(mytype) won't.
template conditionallyInherit(bool choice, T...) {
static if (choice) {
alias conditionallyInherit = T;
}
On 2013-07-14, 07:40, JS wrote:
On Sunday, 14 July 2013 at 05:30:57 UTC, lomereiter wrote:
On Sunday, 14 July 2013 at 05:04:37 UTC, JS wrote:
and while I'm at it I need to conditionally constrain types.
interface A(T) where(!isBasicType!T, (T : B));
which is suppose to require T to inherit f
On Sunday, 14 July 2013 at 09:52:29 UTC, Simen Kjaeraas wrote:
On 2013-07-14, 07:40, JS wrote:
On Sunday, 14 July 2013 at 05:30:57 UTC, lomereiter wrote:
On Sunday, 14 July 2013 at 05:04:37 UTC, JS wrote:
and while I'm at it I need to conditionally constrain types.
interface A(T) where(!isBa
I would like to do something like
enum e
{
@(string) p,
@(int) i
}
class a
{
mixin(generatePropertiesFromEnum!e);
}
which would produce the result
interface a
{
@property string p();
@property int i();
}
I can generate the properties without issue but I can't seem to
attach pr
that should be interface a instead of class a.
On Sunday, 14 July 2013 at 12:33:07 UTC, JS wrote:
I would like to do something like
...
Looks like a grammar issue. UDA's are supposed to be attached to
any symbol declaration as far as I understand, which enum members
definitely are. Probably worth bugzilla entry.
On 07/14/2013 11:37 AM, lomereiter wrote:
I assume that you template ends up creating a dummy interface though
and this isn't really acceptable.
Yes, it does. Once ':' is typed, some inheritance must occur.
Nope.
template Seq(T...){ alias T Seq; }
class C : Seq!(){ }
Why isn't a dummy i
On Sunday, 14 July 2013 at 13:38:41 UTC, Dicebot wrote:
On Sunday, 14 July 2013 at 12:33:07 UTC, JS wrote:
I would like to do something like
...
Looks like a grammar issue. UDA's are supposed to be attached
to any symbol declaration as far as I understand, which enum
members definitely are.
On 07/11/2013 05:58 AM, Chris wrote:
I have a DLL written in D I load into a Python application via ctypes
like so:
lib = CDLL("mydll")
The DLL loads and can be used no problem. However, once the DLL is
discarded of by the program, the program either doesn't react or
crashes. I still haven't wo
The documentation of GC.addRoot() (mentioned by Simen), contains this
interesting piece of example code:
// Also ensure that a moving collector does not relocate
// the object.
GC.setAttr(cast(void*)context, GC.BlkAttr.NO_MOVE);
Looks like we *already* have the way to pin objects to thei
I'm trying to interact with a process using std.process and
redirected stdin/stdout/stderr.
What would be the recommended way?
For example:
auto pipes=pipeShell("myprocess",Redirect.all);
while(true){
pipes.stdin.rawWrite(some_command);
foreach (line; pipes.stdout.byLine) {
//do somet
It would be nice to be able to use enums in a hierarchical way:
enum colors
{
enum Red { RedOrange, ... }
enum Green { GreenBlue, ...}
enum Blue { BlueYellow, ... }
...
}
which would be the same as the flattened version,
enum colors
{
Red, RedOrange, ..., Green, GreenBlue, ...
BTW, the usefulness is to group sub-enums into the same range.
This would make it easy/efficient to branch over a range in the
enum:
if (v in colors.Red) { v is a color in red }
instead of
if (v is color.Red || v is color.RedOrange || ...)
On Monday, 15 July 2013 at 04:27:42 UTC, JS wrote:
BTW, the usefulness is to group sub-enums into the same range.
This would make it easy/efficient to branch over a range in the
enum:
if (v in colors.Red) { v is a color in red }
instead of
if (v is color.Red || v is color.RedOrange || ...)
On 2013-07-15 00:06, Leandro Motta Barros wrote:
The documentation of GC.addRoot() (mentioned by Simen), contains this
interesting piece of example code:
// Also ensure that a moving collector does not relocate
// the object.
GC.setAttr(cast(void*)context, GC.BlkAttr.NO_MOVE);
Looks
Thanks.
Now I realise that D is much less intuitive than C++.
On Monday, 15 July 2013 at 03:49:10 UTC, Timothee Cour wrote:
I'm trying to interact with a process using std.process and
redirected stdin/stdout/stderr.
What would be the recommended way?
For example:
auto pipes=pipeShell("myprocess",Redirect.all);
while(true){
pipes.stdin.rawWrite(some_
19 matches
Mail list logo