Re: D on ARM laptops?

2019-07-03 Thread Nicholas Wilson via Digitalmars-d-learn

On Wednesday, 3 July 2019 at 20:49:20 UTC, JN wrote:
Does anyone know if and how well D works on ARM laptops (such 
as Chromebooks and similar)?


For example this one https://www.pine64.org/pinebook/ . Can it 
compile D? Obviously DMD is out because it doesn't have ARM 
builds. Not sure about GDC. How about LDC?


Haven't tried on laptops, but I can't imagine it would be too 
different to RasPi which LDC worked fine on.


D on ARM laptops?

2019-07-03 Thread JN via Digitalmars-d-learn
Does anyone know if and how well D works on ARM laptops (such as 
Chromebooks and similar)?


For example this one https://www.pine64.org/pinebook/ . Can it 
compile D? Obviously DMD is out because it doesn't have ARM 
builds. Not sure about GDC. How about LDC?


Re: Associative Array & different template types

2019-07-03 Thread ag0aep6g via Digitalmars-d-learn

On 03.07.19 20:20, Robert M. Münch wrote:
So, I need to carry around the object from which a delegate was created 
from because it's not possible to query the delegate for the object 
later somewhere else in the code.


It is possible to get the context object out of a delegate:


class C { void method() {} }
void main()
{
auto c = new C;
void delegate() dg = 
assert(cast(C) dg.ptr is c); /* passes */
}


You just have to know (or carry around) the type so that you can cast 
correctly.


[...]

myObject[string] myObjectArray;

auto mo1 = makeMyStruct!myClassA(mcA, ); // mo1 = myObject
auto mo2 = makeMyStruct!myClassB(mcB, ); // mo2 = myObject

myObjectArray["1"] = mo1;
myObjectArray["2"] = mo2;

assert(mcA == mo1._context)
assert(mcA == myObjectArray["1"]._context)


class MyClassA { void myClassFunc() {} }
class MyClassB { void myClassFunc() {} }

void main()
{
void delegate()[string] myDelegateArray;

auto mcA = new MyClassA;
auto mcB = new MyClassB;

auto dg1 = 
auto dg2 = 

myDelegateArray["1"] = dg1;
myDelegateArray["2"] = dg2;

assert(mcA is cast(MyClassA) dg1.ptr); /* passes */
assert(mcA is cast(MyClassA) myDelegateArray["1"].ptr); /* passes */

/* When void* is good enough, you can use .ptr without a cast: */
assert(dg2.ptr is myDelegateArray["2"].ptr); /* passes */
}


Associative Array & different template types

2019-07-03 Thread Robert M. Münch via Digitalmars-d-learn

I have something like:

template myStruct(T){
auto makeMyStruct(T,E)(T context, void delegate(E) myFunc){
static struct myObject {
this(T context, void delegate(E) myFunc){
_context = context;
_myFunc = myFunc;
}

private:
void delegate(E) _myFunc;
T _context;
}
}
}

class myClass {
void myClassFunc();
}

myClass mc = new myClass;

auto mo = makeMyStruct!myClass(mc, ); // mo = myObject

So, I need to carry around the object from which a delegate was created 
from because it's not possible to query the delegate for the object 
later somewhere else in the code.


Now, I want to keep several of the makeMyStruct!... created objects in 
an AA (or an other container) so that I can compare them with an object 
pointer. Like this (not working code, just pseudo code):



myObject[string] myObjectArray;

auto mo1 = makeMyStruct!myClassA(mcA, ); // mo1 = myObject
auto mo2 = makeMyStruct!myClassB(mcB, ); // mo2 = myObject

myObjectArray["1"] = mo1;
myObjectArray["2"] = mo2;

assert(mcA == mo1._context)
assert(mcA == myObjectArray["1"]._context)


I hope the idea is understandable. Of course this doesn't work because 
myObjectArray needs a template, which creates different types. But with 
different types I can't throw everything into on array. May claases, 
and inheritance from a non-template base type help here?


I would like to keep it as simple as possible...

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: Blog Post #0048: Model, View, Controller

2019-07-03 Thread lpcvoid via Digitalmars-d-learn

On Friday, 28 June 2019 at 14:17:31 UTC, Ron Tarrant wrote:
Today's post on gtkdcoding.com is the first in a 9-part series 
covering GTK's model/view/controller mechanism and how it's 
used in various widgets including the TreeView. Today is mostly 
theory, a reference (if you will) for the rest of the series.


You can read it here: 
https://gtkdcoding.com/2019/06/28/0048-mvc-i-introduction.html


Thanks for the time you invest in this.


Re: How do you link with GtkD in VisualD?

2019-07-03 Thread lpcvoid via Digitalmars-d-learn

On Tuesday, 26 January 2016 at 22:08:23 UTC, Enjoys Math wrote:

On Tuesday, 26 January 2016 at 22:04:55 UTC, Enjoys Math wrote:

[...]


Okay, fixed by changing 'gtkd' setting to 'gtkd.lib'.


I have the same problem. Could you please post the rest of your 
settings?


Thanks!


Re: Mixin mangled name

2019-07-03 Thread Basile B. via Digitalmars-d-learn

On Monday, 1 July 2019 at 23:52:49 UTC, Andrey wrote:

Hello,
Is it possible to mixin in code a mangled name of some entity 
so that compiler didn't emit undefined symbol error? For 
example mangled function name or template parameter?


Yes. An example from the DMD test suite itself :

https://run.dlang.io/is/ctq77S