On 17/08/2015 5:57 p.m., Ozan wrote:
Hi
Working with objectoriented concepts results often in large trees of
related classes. Every instance of a class knows his methods and data.
An example like following would work:
import std.stdio;
class Family { }
class Dad : Family { void greeting() { wri
On 08/16/2015 10:57 PM, Ozan wrote:
> Working with objectoriented concepts results often in large trees of
> related classes. Every instance of a class knows his methods and data.
> An example like following would work:
>
> import std.stdio;
> class Family { }
From the way you use it below, a be
Hi
Working with objectoriented concepts results often in large trees
of related classes. Every instance of a class knows his methods
and data. An example like following would work:
import std.stdio;
class Family { }
class Dad : Family { void greeting() { writeln("I'm dad"); } }
class Boy : F
On Monday, 17 August 2015 at 02:46:02 UTC, Freddy wrote:
I can't get pragma(mangle) to work on templates(or structs).
[...]
I don't know why but it looks like it only works on functions.
Even if a struct is not a template the custom symbol mangle won't
be handled:
---
import std.stdio;
pra
On Monday, 17 August 2015 at 03:14:16 UTC, Adam D. Ruppe wrote:
On Monday, 17 August 2015 at 02:46:02 UTC, Freddy wrote:
Mangling is done at a different level in the compiler than
aliases, so I don't think this is intended to work.
Is there any way I can mangle a template struct then?
On Monday, 17 August 2015 at 02:46:02 UTC, Freddy wrote:
pragma(mangle, "MyAlias") alias MyAlias = MyStruct!("a", "b",
"c" /+very long symbol bloating list+/ );
Mangling is done at a different level in the compiler than
aliases, so I don't think this is intended to work.
On Monday, 17 August 2015 at 00:00:11 UTC, Jonathan M Davis wrote:
On Sunday, August 16, 2015 21:32:08 Warwick via
Digitalmars-d-learn wrote:
Dont know what to make of this, I pretty much get it every
other time I call rdmd. It'll alternate between running fine
and then giving me this error...
On Monday, 17 August 2015 at 02:45:22 UTC, Brandon Ragland wrote:
Since Dynamic Arrays / Slices are a D feature, using pointers
to these has me a bit confused...
Short answer: pointers to slices are usually a mistake, you
probably don't actually want it, but rather should be using a
regular s
On Monday, 17 August 2015 at 02:45:22 UTC, Brandon Ragland wrote:
Howdy,
Since Dynamic Arrays / Slices are a D feature, using pointers
to these has me a bit confused...
Consider:
Now what is especially confusing about this, is that the above
seems to works fine, while this does not:
if(
On Monday, 17 August 2015 at 02:45:22 UTC, Brandon Ragland wrote:
if(file[(*pos + i)] == '}'){
*pos += i;
return;
}
That code doesn't do what you want it do. file is a ((char[])*)
you are indexing the pointer(accessing invalid memory) and
getting a char[].
I can't get pragma(mangle) to work on templates(or structs).
import std.stdio;
struct MyStruct(T...)
{
int var;
void func()
{
writeln(var);
}
}
pragma(mangle, "MyAlias") alias MyAlias = MyStruct!("a", "b", "c"
/+very long symbol bloating list+/ );
void main()
{
Howdy,
Since Dynamic Arrays / Slices are a D feature, using pointers to
these has me a bit confused...
Consider:
string c2s(int* pos, char[]* file, int l){
char[] s;
for(int i = 0; i < l; i++){
s ~= file[(*pos + i)];
}
return s.dup;
}
Now what
On Sunday, 16 August 2015 at 17:33:52 UTC, Benjamin wrote:
I'm having an issue with building my app - even a simple
trivial app (shown below).
[...]
OS X version?
Have you configured your dmd.conf? iirc it requires linker path
changes or something.
Have you looked in /usr/local/lib for li
On Sunday, 16 August 2015 at 23:40:41 UTC, Brandon Ragland wrote:
On Sunday, 16 August 2015 at 23:31:46 UTC, Ali Çehreli wrote:
On 08/16/2015 04:13 PM, Brandon Ragland wrote:
> That makes more sense. Though it does make the ref method
> signature unclear, as it only applies to literals at this
On Sunday, August 16, 2015 21:32:08 Warwick via Digitalmars-d-learn wrote:
> Dont know what to make of this, I pretty much get it every other
> time I call rdmd. It'll alternate between running fine and then
> giving me this error...
>
> C:\Program Files (x86)\Notepad++>rdmd J:\Code\statproc.d
> st
On Sunday, 16 August 2015 at 23:31:46 UTC, Ali Çehreli wrote:
On 08/16/2015 04:13 PM, Brandon Ragland wrote:
> That makes more sense. Though it does make the ref method
> signature unclear, as it only applies to literals at this
> point?
As long as the returned object will be valid after the fu
On 08/16/2015 04:13 PM, Brandon Ragland wrote:
> That makes more sense. Though it does make the ref method
> signature unclear, as it only applies to literals at this
> point?
As long as the returned object will be valid after the function leaves,
it can be anything: one of the ref parameters,
On Sunday, 16 August 2015 at 22:35:15 UTC, Alex Parrill wrote:
On Sunday, 16 August 2015 at 22:31:02 UTC, Brandon Ragland
wrote:
Hi All, I'm a bit confused as to how Classes in D are passed
in arguments and returns.
Take this for example:
class MyClass{
int x = 2;
}
And then in app.d
ref My
On 08/16/2015 03:36 PM, cym13 wrote:
On Sunday, 16 August 2015 at 22:22:07 UTC, Ali Çehreli wrote:
// HERE:
// Error: function deneme.func @nogc function allocates
//a closure with the GC
@nogc auto func(uint[] arr, DelegateRef d)
{
return arr.map!(a => d.d(a));
}
Aren't you makin
On Sunday, 16 August 2015 at 22:31:02 UTC, Brandon Ragland wrote:
Hi All, I'm a bit confused as to how Classes in D are passed in
arguments and returns.
Take this for example:
class MyClass{
int x = 2;
}
And then in app.d
ref MyClass doStuff(){
MyClass mc = new MyClass() // Heap allocation,
On Sunday, 16 August 2015 at 22:31:02 UTC, Brandon Ragland wrote:
ref MyClass doStuff(){
MyClass mc = new MyClass() // Heap allocation, using new
return mc;
}
This attempts to return a reference to the _variable_ `mc`, not a
reference to the class. Just remove `ref` from the function
sig
On Sunday, 16 August 2015 at 22:22:07 UTC, Ali Çehreli wrote:
// HERE:
// Error: function deneme.func @nogc function allocates
//a closure with the GC
@nogc auto func(uint[] arr, DelegateRef d)
{
return arr.map!(a => d.d(a));
}
Aren't you making another delegate in the map by using
Hi All, I'm a bit confused as to how Classes in D are passed in
arguments and returns.
Take this for example:
class MyClass{
int x = 2;
}
And then in app.d
ref MyClass doStuff(){
MyClass mc = new MyClass() // Heap allocation, using new
return mc;
}
The above fails, as "escaping reference
On 08/16/2015 09:26 AM, FreeSlave wrote:
>> It still says it needs allocation:
>>
>> test.d(17): Error: function test.func @nogc function allocates a
>> closure with the GC
I wrapped it inside a class object but it still thinks it needs to allocate:
import std.stdio;
import std.range;
import st
Dont know what to make of this, I pretty much get it every other
time I call rdmd. It'll alternate between running fine and then
giving me this error...
C:\Program Files (x86)\Notepad++>rdmd J:\Code\statproc.d
std.process.ProcessException@std\process.d(550): Failed to spawn
new process (The pr
For reference:
OSX 10.10.5
GDB 7.9.1 (non apple; from homebrew)
yes, it is code signed
Compiling with dub: "dflags": ["-gc", "-gs"]
I would also like to preface this post by saying that everything
works fine in GDB on linux.
When finding that a bug in my program was a null poin
I'm having an issue with building my app - even a simple trivial
app (shown below).
I receive the following error message:
cc -arch i386 -framework CoreFoundation -lobjc -liconv: No such
file or directory
--- errorlevel 255
I've removed and reinstalled DMD - same issue. I
On Sunday, 16 August 2015 at 16:23:05 UTC, FreeSlave wrote:
On Sunday, 16 August 2015 at 15:29:10 UTC, Ali Çehreli wrote:
On 08/16/2015 04:53 AM, FreeSlave wrote:
> The problem is that this allocates delegate, so it can't be
used in
> @nogc code.
Would constructing the delegate by setting its
On Sunday, 16 August 2015 at 15:29:10 UTC, Ali Çehreli wrote:
On 08/16/2015 04:53 AM, FreeSlave wrote:
> The problem is that this allocates delegate, so it can't be
used in
> @nogc code.
Would constructing the delegate by setting its .funcptr and
.ptr properties work in this case? You can have
On 08/16/2015 04:53 AM, FreeSlave wrote:
> The problem is that this allocates delegate, so it can't be used in
> @nogc code.
Would constructing the delegate by setting its .funcptr and .ptr
properties work in this case? You can have a pool of context objects
which become the context for the de
On Sunday, 16 August 2015 at 12:30:54 UTC, cym13 wrote:
On Sunday, 16 August 2015 at 11:53:42 UTC, FreeSlave wrote:
[...]
Ok, so as my lambda proposition obviously doesn't work, here is
one way that does using a templated function. There may be a
way to make it shorter, I don't know.
On Sunday, 16 August 2015 at 11:53:42 UTC, FreeSlave wrote:
Let's say I want to map some range using some context.
The obvious way is to do:
uint[3] arr = [1,2,3];
uint context = 2;
auto r = arr[].map!(delegate(value) { return value * context;
});
The problem is that this allocates delegate,
On Sunday, 16 August 2015 at 12:04:51 UTC, cym13 wrote:
To me the obvious way is to use a lambda, not a delegate:
Lambdas and delegates are the same thing, just different syntax.
On Sunday, 16 August 2015 at 11:25:48 UTC, Nordlöw wrote:
I tried rebuilding my knowledge graph project at
https://github.com/nordlow/justd/tree/master/knet
with DMD 2.068 and it seems like we have a regression in
std.traits: EnumMembers:
[...]
It builds without errors nor warnings on 2.067
On Sunday, 16 August 2015 at 11:53:42 UTC, FreeSlave wrote:
Let's say I want to map some range using some context.
The obvious way is to do:
uint[3] arr = [1,2,3];
uint context = 2;
auto r = arr[].map!(delegate(value) { return value * context;
});
To me the obvious way is to use a lambda, not
On Sunday, 16 August 2015 at 11:43:24 UTC, CharmingChocolate
wrote:
I can cast a ubyte to a byte, but as far as I know I'd only get
positive values out of that conversion.
ubyte b = 255;
byte b2 = cast(byte) b;
assert(b2 == -1);
No information is lost by that cast, all the bits remain exactly
Let's say I want to map some range using some context.
The obvious way is to do:
uint[3] arr = [1,2,3];
uint context = 2;
auto r = arr[].map!(delegate(value) { return value * context; });
The problem is that this allocates delegate, so it can't be used
in @nogc code.
What I want to do might lo
I can cast a ubyte to a byte, but as far as I know I'd only get
positive values out of that conversion. If I was instead getting
a ubyte out of a function and I want to assign those bits to a
byte and have some of those numbers be interpreted as negative
values by the new type they're in, how w
On Sunday, 16 August 2015 at 11:25:48 UTC, Nordlöw wrote:
Try cloning https://github.com/nordlow/justd/tree
Should be:
git clone https://github.com/nordlow/justd
On Sunday, 16 August 2015 at 11:25:48 UTC, Nordlöw wrote:
I tried rebuilding my knowledge graph project at
https://github.com/nordlow/justd/tree/master/knet
Should be, https://github.com/nordlow/justd.
I tried rebuilding my knowledge graph project at
https://github.com/nordlow/justd/tree/master/knet
with DMD 2.068 and it seems like we have a regression in
std.traits: EnumMembers:
/usr/include/dmd/phobos/std/traits.d(3432,21): Error: template
instance std.traits.EnumMembers!(Lang).WithIdent
> Must create a ticket for it ?
I think so. Unless others object in 10 minutes... :)
:-)
Done : https://issues.dlang.org/show_bug.cgi?id=14925
Thanks for your help
42 matches
Mail list logo