On Thu, 21 Aug 2014 05:39:14 +
Shachar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
auto onDispatch(string m, Args...)(Args args)
first: opDispatch, not onDispatch.
second: underscoresToCamelCase() can't be evaluated in compile-time
anymore. the necessary changes:
1.
On Thu, 21 Aug 2014 05:39:14 +
Shachar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
that's it: failing to evaluate opDispatch() template is not a
compilation error. compiler will silently try to find direct method if
opDispatch() fails. so be very careful with it.
you can
On Thursday, 21 August 2014 at 06:11:06 UTC, ketmar via
Digitalmars-d-learn wrote:
that will do the trick.
Indeed. I ended up simply directly calling
a.opDispatch!do_something_cool(5, 6), which brought most of
those issues to light.
Shachar
On Thu, 21 Aug 2014 06:34:10 +
Shachar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
Indeed. I ended up simply directly calling
a.opDispatch!do_something_cool(5, 6), which brought most of
those issues to light.
ah, silly me. i forgot about such simple thing.
On Wednesday, 20 August 2014 at 20:18:15 UTC, Dicebot wrote:
On Wednesday, 20 August 2014 at 20:01:05 UTC, Colin wrote:
I see 3 distinct parts playing a role in my confusion:
A) The 'is' keyword. What does it do when you have
is(expression);
http://dlang.org/expression.html#IsExpression
It
tl;dr - how to get child classname from inherited parent function
at compile time?
class A { string getName(); };
class B { };
B foo = new B;
assert(foo.getName() == B);
...
Hi! I'm stuck at one issue, and I don't know how to solve it. I
think this is about mixins/templates, isn't it?
When
On Tuesday, 19 August 2014 at 20:33:00 UTC, monarch_dodra wrote:
On Monday, 18 August 2014 at 13:51:14 UTC, nrgyzer wrote:
Hi all,
I've the following code snipped:
import std.bigint;
void main(string[] args)
{
BigInt i = 12345;
if (args.length 1)
{
I found a rough solution. It's not ideal and I still want to make
autoinject, but it works.
mixin template Manager(T) {};
class Component {};
class Sprite:Component
{
mixin Manager!Sprite;
};
1) How to make mixin inject automatic?
2) If it's impossible, how to use mixin Manager; without
On Thursday, 21 August 2014 at 12:58:13 UTC, MarisaLovesUsAll
wrote:
I found a rough solution. It's not ideal and I still want to
make autoinject, but it works.
mixin template Manager(T) {};
class Component {};
class Sprite:Component
{
mixin Manager!Sprite;
};
1) How to make mixin inject
I'm trying to make a tree data structure in part of my first
non-trivial D-based program. Turns out that DMD likes to re-use
PODs - sounds good, but that trapped me, and I'm not sure how to
clear myself out of the problem nicely.
My simplified, but not oversimplified, example is
On Thursday, 21 August 2014 at 14:09:24 UTC, Ricky C wrote:
I'm trying to make a tree data structure in part of my first
non-trivial D-based program. Turns out that DMD likes to
re-use PODs - sounds good, but that trapped me, and I'm not
sure how to clear myself out of the problem nicely.
On Thursday, 21 August 2014 at 14:09:24 UTC, Ricky C wrote:
TileTree* self;
Don't do that. D has banned internal pointers to implement its
move semantics.
branches[index] = tile_trees[index];
This will make a *value-copy* of your TileTree nodes. There are
good chances it'll break your
On 08/21/2014 04:12 AM, nrgyzer wrote:
I'm using the goto-command to exit my function
if an error (not necessarily an exception) occured.
Sorry to repeat myself but if an exception occurs in code before the
goto, the exit code will not be executed. Of course, it may be that the
function is
There were 2 talks about bare metal D this year at the D conference.
The first one is about someone able to use D on microcontrollers with a few
k ram.:
https://www.youtube.com/watch?v=o5m0m_ZG9e8
The second one is about someone trying to strip almost everything out and
see what works:
On Thursday, 21 August 2014 at 17:39:16 UTC, Ali Çehreli wrote:
On 08/21/2014 04:12 AM, nrgyzer wrote:
I'm using the goto-command to exit my function
if an error (not necessarily an exception) occured.
Sorry to repeat myself but if an exception occurs in code
before the goto, the exit code
Hi everyone,
I'm facing a problem with the JSON functions. I've to communicate
with another PC using JSON. Here's a simple snipped which shows
my problem:
import std.json;
import std.stdio;
void main()
{
double d = 1.23456789;
JSONValue j = d;
sendToRemote(toJSON(j));
}
On Thursday, 21 August 2014 at 13:19:06 UTC, anonymous wrote:
1) How to make mixin inject automatic?
You could use this pattern:
interface Component {}
class ComponentImpl(T) {}
class Sprite : ComponentImpl!Sprite {}
From my view, it's an architectural crutch. %)
You can use `typeof(this)`
On Thursday, 21 August 2014 at 03:02:53 UTC, Paul D Anderson
wrote:
What changed? It ran okay with early beta versions, but not
with the release.
Paul
It compiles in beta-5 but not beta-6. Is the list of changes in
the beta testing wiki complete? None seem pertinent.
monarch_dodra:
On 8/21/14, 6:38 AM, MarisaLovesUsAll wrote:
tl;dr - how to get child classname from inherited parent function at
compile time?
class A { string getName(); };
class B { };
B foo = new B;
assert(foo.getName() == B);
...
Hi! I'm stuck at one issue, and I don't know how to solve it. I think
this
On Thursday, 21 August 2014 at 19:58:18 UTC, MarisaLovesUsAll
wrote:
When I make mixin injection in one class, I want auto-injection
in another class. How can I do this?
class Component:GameObject
{
//second injection must be here and must be automatic
};
class Sprite:Component
{
On Thursday, 21 August 2014 at 20:05:13 UTC, Ary Borenszweig
wrote:
I'll tell you how it's done in Crystal in case someone wants to
come up with a proposal to make it work in D.
~~~
class Foo
macro inherited
def method_in_{{@class_name.downcase.id}}
puts Hello {{@class_name.id}}!
On Thursday, 21 August 2014 at 20:16:33 UTC, anonymous wrote:
Maybe you can explain what you're trying to achieve with all
this. There may be a different/better way to do it.
Sure.
Class tree: GameObject-Component-Sprite.
GameObject structure:
Component[];
Component
On 08/21/2014 11:53 AM, nrgyzer wrote:
double d = 1.23456789;
JSONValue j = d;
sendToRemote(toJSON(j));
}
My problem is that the remote PC receives 1.23457 instead of
1.23456789.
I think it is due to the following code simply calling to!string in
std/phobos/json.d:
On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote:
I don't think it is a concern as JSON does not encode types. It
is up to the receiver how to interpret the data. Here is the
output of the program above:
{value:1.234567889998901}
Ali
JSON may not encode the very specific
On Wednesday, 20 August 2014 at 20:46:20 UTC, Paul D Anderson
wrote:
Re-compiling existing code with version 2.066 generates a lot
of errors complaining about implicit conversion to const.
Typical is this call (inside a struct with properties 1 2):
z.sign = x.sign ^ y.sign;
Error:
I'm currently receiving several errors when trying to compile
this code with DMD 2.066 (beginning with RC1):
https://github.com/Xinok/XSort
The compiler throws an error because it's unable to deduce a type
for the predicate in a few places. This repository compiles just
fine in DMD 2.065 and
This is the full compiler output:
combsort.d(90): Error: template D main.pred cannot deduce
function from argument
types !()(uint, uint), candidates are:
benchsort.d(37):benchsort.main.pred(T)(T a, T b)
benchsort.d(81): Error: template instance
combsort.combSortLinear!(pred, uint[])
What would be a good answer to this article?
http://swiftcoder.wordpress.com/2009/02/18/raii-why-is-it-unique-to-c/
Especially the part mentioning D:{
D’s scope keyword, Python’s with statement and C#’s using declaration all
provide limited RAII, by allowing resources to have a scoped lifetime,
http://dlang.org/phobos/std_typecons.html#.RefCounted
On Friday, 22 August 2014 at 02:22:16 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
What would be a good answer to this article?
It's own publication date: Feb 2009. The D struct has changed a
lot since then, getting new features (@disable, postblit, more
reliable destructor) and bugs
On Thu, Aug 21, 2014 at 7:26 PM, Dicebot via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
http://dlang.org/phobos/std_typecons.html#.RefCounted
That doesn't work with classes though; is there any way to get a ref
counted class?
(and btw RefCounted should definitely appear in
On Friday, 22 August 2014 at 01:25:05 UTC, Paul D Anderson wrote:
On Wednesday, 20 August 2014 at 20:46:20 UTC, Paul D Anderson I
don't know if this is expected behavior that just wasn't
enforced before, or if this is something new. Either way I
don't like it. And I'm a little surprised I'm
On Friday, 22 August 2014 at 03:00:01 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
On Thu, Aug 21, 2014 at 7:26 PM, Dicebot via
Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
http://dlang.org/phobos/std_typecons.html#.RefCounted
That doesn't work with classes though; is
On Friday, 22 August 2014 at 02:22:16 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Especially the part mentioning D:{
D’s scope keyword, Python’s with statement and C#’s using
declaration all
provide limited RAII, by allowing resources to have a scoped
lifetime, but
none of them readily
34 matches
Mail list logo