Re: function overrides but is not covariant

2013-04-29 Thread Namespace

Nobody knows?


Re: GtkD No GSettings schemas installed

2013-04-29 Thread QAston

On Sunday, 28 April 2013 at 17:18:48 UTC, Mike Wey wrote:

On 04/28/2013 04:32 PM, QAston wrote:

On Monday, 15 April 2013 at 18:10:00 UTC, Mike Wey wrote:

On 04/15/2013 05:45 PM, Josh wrote:

On Sunday, 14 April 2013 at 13:34:07 UTC, Mike Wey wrote:


So it looks like the shemas are installed properly.

You could try running the gsettings app from a different 
location than

where it's located, it should be in your path.
If it doesn't give the same output then there may be a 
problem with

how the path is setup.

If it gives the same output then i have no idea what else 
could be

going on.


Yeah, it gives the same output when I run it from somewhere 
else. Guess
I'm back to where I started. Thanks for all your help though 
Mike.


Josh


Could you post the output of the following gtkD app:

import glib.Util;
import std.stdio;

void main()
{
   writeln(Util.getSystemDataDirs());
}


I have the same problem as Josh, your code prints:
[C:\\ProgramData, C:\\Users\\Public\\Documents, 
C:\\Program Files

(x86)\\GtkSharp\\2.12\\share, [app location here]\\share]


It looks like a path issue you could try putting the location 
of the Gtk+ 3 installation before that of GtkSharp and see if 
that fixes the problems.


I've set GTK_BASEPATH as gtkd wiki says(didn't notice that 
before) and it helped. Thanks!


Re: function overrides but is not covariant

2013-04-29 Thread John Colvin

On Sunday, 28 April 2013 at 19:45:41 UTC, Namespace wrote:

That surprised me a bit. Is that expected?


import std.stdio;

struct A { }

interface IFoo {
void bar(ref const A);
}

class Foo : IFoo {
void bar(ref const A a) {

}

void bar(const A a) {
return this.bar(a);
}
}

prints:

Error: function c517.Foo.bar of type void(const(A) a) overrides 
but is not covariant with c517.IFoo.bar of type void(ref 
const(A))


Not surprising to me at all. Why would ref be covariant with 
non-ref?


Re: function overrides but is not covariant

2013-04-29 Thread Namespace
Not surprising to me at all. Why would ref be covariant with 
non-ref?


I do not understand the error fully. Why I cannot overload the 
method in the class with non-ref?


C to D conversion for function

2013-04-29 Thread Sumit Raja

Hi,

I wanted some help in converting this

void av_log_ask_for_sample(void *avc, const char *msg, ...) 
av_printf_format(2, 3);


from C to D.

I don't know what it means or is called in C to start with so I 
am a bit lost on what to search for.


Thanks

Sumit


Re: function overrides but is not covariant

2013-04-29 Thread Timon Gehr

On 04/28/2013 09:45 PM, Namespace wrote:

That surprised me a bit. Is that expected?


import std.stdio;

struct A { }

interface IFoo {
 void bar(ref const A);
}

class Foo : IFoo {
 void bar(ref const A a) {

 }

 void bar(const A a) {
 return this.bar(a);
 }
}

prints:

Error: function c517.Foo.bar of type void(const(A) a) overrides but is
not covariant with c517.IFoo.bar of type void(ref const(A))


Seems to be a bug.


Re: C to D conversion for function

2013-04-29 Thread Timon Gehr

On 04/29/2013 12:57 PM, Sumit Raja wrote:

Hi,

I wanted some help in converting this

void av_log_ask_for_sample(void *avc, const char *msg, ...)
av_printf_format(2, 3);

from C to D.

I don't know what it means or is called in C to start with so I am a bit
lost on what to search for.

Thanks

Sumit


av_printf_format is a preprocessor macro that expands to a built-in 
compiler attribute which enables compile-time printf-style format string 
checking. There is no support for such a feature in any D compiler.


You want

void av_log_ask_for_sample(void* avc, const(char)* msg, ...);


In case you want to preserve the attribute:

struct av_printf_format{ int fmtpos, attrpos; }

@av_printf_format(2, 3) void av_log_ask_for_sample(void* avc, 
const(char)* msg, ...);




Re: C to D conversion for function

2013-04-29 Thread 1100110
On 04/29/2013 06:50 AM, Timon Gehr wrote:
 On 04/29/2013 12:57 PM, Sumit Raja wrote:
 Hi,

 I wanted some help in converting this

 void av_log_ask_for_sample(void *avc, const char *msg, ...)
 av_printf_format(2, 3);

 from C to D.

 I don't know what it means or is called in C to start with so I am a bit
 lost on what to search for.

 Thanks

 Sumit
 
 av_printf_format is a preprocessor macro that expands to a built-in
 compiler attribute which enables compile-time printf-style format string
 checking. There is no support for such a feature in any D compiler.
 
 You want
 
 void av_log_ask_for_sample(void* avc, const(char)* msg, ...);
 
 
 In case you want to preserve the attribute:
 
 struct av_printf_format{ int fmtpos, attrpos; }
 
 @av_printf_format(2, 3) void av_log_ask_for_sample(void* avc,
 const(char)* msg, ...);
 

What is the difference between const(char)*, and const(char*)?  I have
seen them used pretty much interchangeably...

Are they? Somehow I don't think they are.


Re: C to D conversion for function

2013-04-29 Thread Timon Gehr

On 04/29/2013 02:17 PM, 1100110 wrote:

...
What is the difference between const(char)*, and const(char*)?  I have
seen them used pretty much interchangeably...

Are they? Somehow I don't think they are.



Variables of type const(char)* can be mutated, while const(char*) cannot be.

void main(){
const(char)* a = 123.ptr;
*a = 2;// error
a = 456.ptr; // ok
const(char*) b = 123.ptr;
*b = 2;// error
b = 456.ptr; // error
}


Re: C to D conversion for function

2013-04-29 Thread Sumit Raja

On Monday, 29 April 2013 at 11:50:21 UTC, Timon Gehr wrote:


In case you want to preserve the attribute:

struct av_printf_format{ int fmtpos, attrpos; }

@av_printf_format(2, 3) void av_log_ask_for_sample(void* avc, 
const(char)* msg, ...);


Thanks. What does @av_printf_format(2, 3) do to the function?



debugging on Mac OSX

2013-04-29 Thread Daniel Davidson
Ho do you debug D executables on mac os x in which debug symbols 
are available (preferably a setup that works in emacs with gdb or 
gud-gdb)?


This thread seems to bring up the issue I am seeing:

http://forum.dlang.org/thread/k55tiv$28u3$1...@digitalmars.com

but no solution is provided. Also, this bug,

http://d.puremagic.com/issues/show_bug.cgi?id=2741

seems to specifically talk to the issue and is closed RESOLVED 
FIXED. Yet I am unable to get it to work.


In this thread on usability of D dev environment from OSX, 
several people are having success developing D on OSX. Question 
is, do they debug and if so how? (hopefully not just print 
statements)


I am a switcher, just trying out the mac ecosystem. On ubuntu 
linux, for my rather small sample apps emacs (M-x gdb) just 
works, assuming I've built with rdmd specifying debug and that 
the command build only (to keep the binary). The symbols and line 
numbers are available.


Is there a setup for Mac that others are having success with?

Thanks
Dan


Re: debugging on Mac OSX

2013-04-29 Thread evilrat

On Monday, 29 April 2013 at 12:46:01 UTC, Daniel Davidson wrote:
Ho do you debug D executables on mac os x in which debug 
symbols are available (preferably a setup that works in emacs 
with gdb or gud-gdb)?


there is no solid solution as far as i know. you can try build 
zerobugs debugger from sources or mac ports(fails for me due to 
some libs on mountain lion) which has GUI and supports D, but now 
abandoned.


but my way is just to build with -gc and run lldb like this.
$ cd to/your/app/workdir
$ lldb

start appname
run

...
(sry, not used for some time)

if it crashes you will get nice lldb output and so on. maybe one 
day someone will do a GUI tool for this or maybe there is already 
one idk...


unfortunately mac development is really PITA so i'm just using 
VisualD on windows, and then test changes on mac. also i have 
tried MonoD both on windows and mac but it has even more 
inconvenient than VisualD, doesn't(?) have debugger integration 
and its project and file organization just kills me though it has 
better code completion...


Re: function overrides but is not covariant

2013-04-29 Thread John Colvin

On Monday, 29 April 2013 at 09:23:01 UTC, Namespace wrote:
Not surprising to me at all. Why would ref be covariant with 
non-ref?


I do not understand the error fully. Why I cannot overload the 
method in the class with non-ref?


Sorry, my mistake, it looks like a bug. Dmd thinks that you're 
trying to override, not overload.


Re: function overrides but is not covariant

2013-04-29 Thread Ali Çehreli

On 04/28/2013 12:45 PM, Namespace wrote:

 That surprised me a bit. Is that expected?

 
 import std.stdio;

 struct A { }

 interface IFoo {
  void bar(ref const A);
 }

 class Foo : IFoo {
  void bar(ref const A a) {

  }

  void bar(const A a) {
  return this.bar(a);
  }
 }
 
 prints:

 Error: function c517.Foo.bar of type void(const(A) a) overrides but is
 not covariant with c517.IFoo.bar of type void(ref const(A))

As others have said, one would expect this to compile because it is very 
common to overload on the same struct type, one taking by-value, the 
other taking by-reference. The former is mainly to capture rvalue struct 
objects and the latter is for lvalues.


To match what is common in Phobos and TDPL is to define the by-value 
overload without 'const':


void bar(A a) {
return this.bar(a);
}

This example now compiles.

Ali



Re: function overrides but is not covariant

2013-04-29 Thread Namespace

On Monday, 29 April 2013 at 11:40:45 UTC, Timon Gehr wrote:

On 04/28/2013 09:45 PM, Namespace wrote:

That surprised me a bit. Is that expected?


import std.stdio;

struct A { }

interface IFoo {
void bar(ref const A);
}

class Foo : IFoo {
void bar(ref const A a) {

}

void bar(const A a) {
return this.bar(a);
}
}

prints:

Error: function c517.Foo.bar of type void(const(A) a) 
overrides but is

not covariant with c517.IFoo.bar of type void(ref const(A))


Seems to be a bug.


I filled a new bug report. But the title is broken because of the 
very nice copy functionality of my tablet.


Re: how hash_t toHash() works?

2013-04-29 Thread gedaiu

On Sunday, 28 April 2013 at 13:18:04 UTC, Ivan Kazmenko wrote:

Hi,

I have a class which I want to use as key in an assoc array 
like

this:

string[KeyString] myArray;

What i want is to preserve the order in the array. I want 
always

to have 1 before 2 if the string is a numeric value.

Can anyone help me to understand how const hash_t toHash() 
should

work?


Associative arrays in D are implemented as hash tables.  
Hashing sacrifices ordering capabilities for greater speed.  
Creating a hash table will most certainly take your toHash 
value modulo some integer you can not control (small for small 
tables, large for larger ones).  It would be crippling, if at 
all possible, to have foreach on an associative array always 
produce a sorted result.


I'd suggest using std.container.RedBlackTree instead.  It 
doesn't provide syntactic sugar (like container[key] = value) 
but preserves the ordering.


Also note that sorting items as strings should be separated 
from sorting as integers.  For example, a value convertible to 
integer should be always less (or always greater) than a 
non-convertible value.  Otherwise, it would quickly lead to 
inconsistent comparisons, as in 22 s 22a s 4 n 22.  
Here, s compares values as strings and n as integers.


Below is an example of using RedBlackTree close to what you 
might need:


-
import std.container;
import std.conv;
import std.stdio;

bool doConv(out long val, string s) {
try {
val = to!long(s);
return true;
}
catch(ConvException) {
return false;
}
}

struct KeyString {
string str;

KeyString opAssign(string val) {
str = val;
return this;
}

const int opCmp(ref const KeyString s) {
long v1, v2;
auto b1 = doConv(v1, str);
auto b2 = doConv(v2, s.str);
if (b1 != b2) return b2 - b1;
if (b1  b2) return (v1  v2) - (v1  v2);
return std.string.cmp(str, s.str);
}
}

struct MyRecord {
KeyString key;
int val;

this(string nkey, int nval) {
key = nkey;
val = nval;
}
}

void main () {
auto cont = redBlackTree !(a.key  b.key, true, MyRecord) ();
cont.insert(MyRecord(1, 1));
cont.insert(MyRecord(111, 2));
cont.insert(MyRecord(25, 3));
cont.insert(MyRecord(53, 4));
cont.insert(MyRecord(a, 5));
cont.insert(MyRecord( , 6));
cont.insert(MyRecord(1234567890123456789, 7));
cont.insert(MyRecord(12345678901234567890, 8));
foreach (ref const cur; cont) {
writefln(cont[\%s\] = %s, cur.key.str, cur.val);
}
}
-

The example prints:

-
cont[1] = 1
cont[25] = 3
cont[53] = 4
cont[111] = 2
cont[1234567890123456789] = 7
cont[ ] = 6
cont[12345678901234567890] = 8
cont[a] = 5
-

The last three entries are strings not convertible to a long, 
so they are ordered lexicographically.


Ivan Kazmenko.


Thanks!

it looks great!

one more questionWhat is the type of cont?

auto cont = redBlackTree !(a.key  b.key, true, MyRecord) ();

I want to use this as a property in a class and i can't use there 
auto keyword... I tried different types but it did not work.


Bogdan


Re: how hash_t toHash() works?

2013-04-29 Thread Ivan Kazmenko

one more question
What is the type of cont?

auto cont = redBlackTree !(a.key  b.key, true, MyRecord) ();

I want to use this as a property in a class and i can't use 
there auto keyword... I tried different types but it did not 
work.


For me, the following declaration works:

-
import std.functional;
...
RedBlackTree !(MyRecord, binaryFun!a.key  b.key, true) cont;
...
cont = redBlackTree !(a.key  b.key, true, MyRecord) ();
-

I admit it could have been easier to figure out.  For example, 
writeln (typeof (cont).stringof); just prints RedBlackTree 
which is not enough for a proper declaration.  I've inferred the 
right declaration from the following lines in container.d:


-
/++ Ditto +/
auto redBlackTree(alias less, bool allowDuplicates, E)(E[] 
elems...)

if(is(typeof(binaryFun!less(E.init, E.init
{
//We shouldn't need to instantiate less here, but for some 
reason,
//dmd can't handle it if we don't (even though the template 
which

//takes less but not allowDuplicates works just fine).
return new RedBlackTree!(E, binaryFun!less, 
allowDuplicates)(elems);

}
-


lookahead on ranges

2013-04-29 Thread Sebastian Graf

Hi,

is there any way to to something like

auto arr = [1,2,3,4,5];
auto delta = arr.lookahead!b-a(1); // or probably pass 1 as 
template arg

assert(equal(delta[], [1,1,1,1][]);

or like

// lookahead returns range of tuples (template arg) or arrays 
(runtime arg)

foreach (a, b; arr.lookahead!1)
writeln(b-a);

on a range? I think I could possibly do this with zip, but I am 
curious if there is something more to the point to do it in 
phobos. In particular something that just buffers n eles and does 
not copy the input range to popFront() all of them.


Re: lookahead on ranges

2013-04-29 Thread bearophile

Sebastian Graf:


is there any way to to something like

auto arr = [1,2,3,4,5];
auto delta = arr.lookahead!b-a(1); // or probably pass 1 
as template arg

assert(equal(delta[], [1,1,1,1][]);

or like

// lookahead returns range of tuples (template arg) or 
arrays (runtime arg)

foreach (a, b; arr.lookahead!1)
writeln(b-a);


I think there isn't something like that in Phobos (I can't be 
fully sure because std.algorithm and std.range contain lot of 
powerful stuff, and it's not easy to know every possible 
combination of them).


So I think you should use zip.

Time ago I have suggested to add a second argument to chunks:
http://d.puremagic.com/issues/show_bug.cgi?id=6621

With that you can do something like:

auto arr = [1,2,3,4,5];
auto delta = arr.chunks(2, 1).map!(p = p[1] - p[0]);


Note that today this:

assert(equal(delta[], [1,1,1,1][]));

is written like this:

assert(equal(delta, [1,1,1,1]));

Or even:

assert(delta.equal([1,1,1,1]));

The online documentation is old.

Bye,
bearophile


Re: debugging on Mac OSX

2013-04-29 Thread Jacob Carlborg

On 2013-04-29 14:45, Daniel Davidson wrote:

Ho do you debug D executables on mac os x in which debug symbols are
available (preferably a setup that works in emacs with gdb or gud-gdb)?

This thread seems to bring up the issue I am seeing:

http://forum.dlang.org/thread/k55tiv$28u3$1...@digitalmars.com

but no solution is provided. Also, this bug,

http://d.puremagic.com/issues/show_bug.cgi?id=2741

seems to specifically talk to the issue and is closed RESOLVED FIXED.
Yet I am unable to get it to work.

In this thread on usability of D dev environment from OSX, several
people are having success developing D on OSX. Question is, do they
debug and if so how? (hopefully not just print statements)

I am a switcher, just trying out the mac ecosystem. On ubuntu linux, for
my rather small sample apps emacs (M-x gdb) just works, assuming I've
built with rdmd specifying debug and that the command build only (to
keep the binary). The symbols and line numbers are available.

Is there a setup for Mac that others are having success with?


See:

* http://d.puremagic.com/issues/show_bug.cgi?id=8172
* http://d.puremagic.com/issues/show_bug.cgi?id=8207

--
/Jacob Carlborg


Re: lookahead on ranges

2013-04-29 Thread Sebastian Graf

On Monday, 29 April 2013 at 16:39:21 UTC, bearophile wrote:


I think there isn't something like that in Phobos (I can't be 
fully sure because std.algorithm and std.range contain lot of 
powerful stuff, and it's not easy to know every possible 
combination of them).


So I think you should use zip.

Time ago I have suggested to add a second argument to chunks:
http://d.puremagic.com/issues/show_bug.cgi?id=6621

With that you can do something like:

auto arr = [1,2,3,4,5];
auto delta = arr.chunks(2, 1).map!(p = p[1] - p[0]);


Note that today this:

assert(equal(delta[], [1,1,1,1][]));

is written like this:

assert(equal(delta, [1,1,1,1]));

Or even:

assert(delta.equal([1,1,1,1]));

The online documentation is old.

Bye,
bearophile


Thanks. Sounds good.


Re: debugging on Mac OSX

2013-04-29 Thread Dan

On Monday, 29 April 2013 at 16:48:27 UTC, Jacob Carlborg wrote:

On 2013-04-29 14:45, Daniel Davidson wrote:
Ho do you debug D executables on mac os x in which debug 
symbols are
available (preferably a setup that works in emacs with gdb or 
gud-gdb)?


This thread seems to bring up the issue I am seeing:

http://forum.dlang.org/thread/k55tiv$28u3$1...@digitalmars.com

but no solution is provided. Also, this bug,

http://d.puremagic.com/issues/show_bug.cgi?id=2741

seems to specifically talk to the issue and is closed RESOLVED 
FIXED.

Yet I am unable to get it to work.

In this thread on usability of D dev environment from OSX, 
several
people are having success developing D on OSX. Question is, do 
they

debug and if so how? (hopefully not just print statements)

I am a switcher, just trying out the mac ecosystem. On ubuntu 
linux, for
my rather small sample apps emacs (M-x gdb) just works, 
assuming I've
built with rdmd specifying debug and that the command build 
only (to

keep the binary). The symbols and line numbers are available.

Is there a setup for Mac that others are having success with?


See:

* http://d.puremagic.com/issues/show_bug.cgi?id=8172
* http://d.puremagic.com/issues/show_bug.cgi?id=8207


Thanks. What is the takeaway? That it does not work and can not 
work until these two bugs are fixed? A simple I don't think you 
can get there from here?


Arrays of functions, function signatures and template instantiation

2013-04-29 Thread JR
I'm piecing together a small IRC bot as my second pet project, 
and next up is splitting the socket-listening/event handling into 
a separate thread.


TL;DR: skip to the link at the bottom -- can't it be done neater?


Raw IRC commands are strings whose format differs depending on 
the *type* of the IRC event (for lack of a better word). These 
event types are arbitrary short strings like NICK, PRIVMSG, 
NOTICE, PING, 001, etc. I'd sleep better if it were an 
enum, but as it is I'm parsing the type from the raw string by 
regex, so obviously I'm getting another string out of it. 
(Granted, you could cast them to that enum in a huge switch, but 
I'm not sure you'd gain any academic efficiency points 
considering the extra time spent in that switch.)


After some more regex I have an Event struct with string members 
like .sender, .target, .type, .content and some others. 
Naturally, depending on what actually happened I may want to 
react to it. Most on-event reactions are functions to pass the 
Event to, like onPrivateMessage(Event evt) -- but sometimes I 
want to know the impending server response of a command I just 
sent.


As an example, when you connect to a server, the first things you 
send are user details (full name etc) and a nickname request. If 
what the server sends next is the welcome event 001, then all 
is well -- wait for the end-of-motd event 376 and then slowly 
start joining your channels and doing your stuff. But if it is 
the nickname-in-use event 433, then everything stops until you 
have requested an available nick.


So I had in mind an event handler and a message dispatcher. The 
event handler would be in its own thread listening to the socket 
stream, and once it reads a string it would parse it into an 
Event, then pass it along to the message dispatcher. The 
dispatcher would keep a record of which threads have registered 
interest in receiving what events, and would send messages 
accordingly. The solution that springs to mind is an associative 
matrix/array-of-array where one of the index keys is the event 
type string, and the other is the thread ID (Tid).


But I still want to keep onPrivateMessage(Event evt) and friends 
around, so in a stroke of hubris I thought it would be neat if I 
could find a generic solution that could work with both arrays of 
thread IDs *and* arrays of function pointers. I'm not sure where 
the 'event handler' struct would end and where the 'message 
dispatcher' would start though -- perhaps I'll just combine them, 
call it Overlord and be done with it. Or maybe 
ResponsibilityCreep.


Much shotgun programming later and I now have two templates; 
MatrixWalker and FuncRunner, subject to serious renaming. (They 
were called Herp and Derp a few hours back.)


Given a function pointer and a matrix of type Foo[Tid][string], 
MatrixWalker will foreach all and invoke the function on both 
keys (Tid, string) and the final element Foo. The function 
signature must match the types used, hence the FuncRunner 
template as an adapter. Tid needn't be Tid unless it's in the 
context of messaging, naturally, and in the context of messaging 
Foo is irrelevant and could be bool. (Keeping a single array like 
Tid[string] would only allow for one event registered per Tid, so 
Tid has to be a key unless you could somehow store multiple 
values per key. Even if possible [?], deregistering the right Tid 
from an event string key wouldn't be straightforward anymore.)


Error: function expected before (), not func of type void 
function(string, uint)*

Yay! Woe.


http://dpaste.dzfl.pl/9273fb92

Can't it be done neater than this? It *does* work now, but it's 
incredibly hacky and I'm not satisfied with it. The whole 
'passing a function pointer to a function that casts the 
signature and invokes it' deal makes me cringe. :



Many thanks in advance, would love any and every piece of advice 
you could spare. With some luck there are some easy shortcuts and 
I'm just too green to see them.


Re: Internationalization vs. Unicode

2013-04-29 Thread Jesse Phillips

On Monday, 29 April 2013 at 18:36:32 UTC, Tyro[17] wrote:

This might work. Not sure yet. The first thing that caught my 
eyes is


You'll find the ported Java source:
https://github.com/d-widget-toolkit/base/tree/master/src


Re: debugging on Mac OSX

2013-04-29 Thread Timothee Cour
Having a proper debugging support of D programs on linux/OSX/windows should
be a top priority, as it makes bug fixing really hard.
I also spent some time with zerobugs route. It looks like a dead end and
its developer will most likely not put more effort into it.

Here's what I have:

A) default stacktraces on linux (ubuntu, if that matters): (dmd -g
test_hello.d which has an assert(0);){
no function name, no file, no line numbers:
core.exception.AssertError@tests.test_hello(6): Assertion failure

filename() [0x40fc16]
filename() [0x40d86d]
...
}

B) default stacktraces on OSX{
function name, but no file and no line numbers
core.exception.AssertError@tests.test_hello(9): Assertion failure

5   test0x00010f6305a6 _d_assertm + 38
6   test0x00010f61204a void
tests.test_hello.__assert(int) + 26
7   test0x00010f612016 _Dmain + 42
8   test0x00010f630e95 extern (C) int
rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void
runMain() + 33
...
}

C) stacktraces on OSX with some modifications I did involving wrapping
atos, etc: {

shows function name, full file, line numbers, and catches segfaults.
0  file: exception.d:356 pure @safe bool
std.exception.enforce!(bool).enforce(bool, lazy const(char)[],
immutable(char)[], ulong)
1  file: path/som_file.d:100 void util.some_function(int x)
...

Some problems:
in case of segfault, the very latest stack frame is missing (so we only
have the parent of the parent of the function that caused the segfault,
plus anything older).

in some rare cases we only have the file name but no file path information.

}

D) debugging on ubuntu:
gdb/cgdb works ok: file, line numbers, we can break on a un-mangled
function name.
However it seems name demangling is partial: I see stuff
like std.stdio.__T7writelnTAAyaZ.writeln() (_param_0=...); maybe it has
issues with templates.  Also, I have issue making info locals work, and it
doesn't understand full D syntax etc.

E) debugging on OSX with apple's gdb (apple ships an old gdb: 6.3.50):
shows full file path, line numbers, but no symbol demangling. Cannot break
on unmangled function name.

F) debugging on OSX with 7.5.1 (eg: brew install
https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb){

* requires to be run with sudo or code-signing
* doesn't show file/line numbers; function names appear mangled, eg:
#1  0x0001104a in D5tests10test_hello8__assertFiZv ()

}



Conclusions:
stacktraces on OSX can be made to work almost perfectly (caveat: missing
last stack frame on segfault), but doesn't work at all on linux
gdb works well on linux, but not at all on OSX

If anyone has a setup that works better at least in some respect, please
let me know!


Re: debugging on Mac OSX

2013-04-29 Thread evilrat

On Monday, 29 April 2013 at 18:49:46 UTC, 1100110 wrote:


In my opinion, don't even bother going to the zerobugs website.
It'll be a long, boring, annoying waste of time.


i don't. zerobugs source is on codeplex


Re: debugging on Mac OSX

2013-04-29 Thread Timothee Cour
were you able to use it ? if so on which platforms? and does it provide
anything beyond what cgdb does?

On Mon, Apr 29, 2013 at 5:41 PM, evilrat evilrat...@gmail.com wrote:

 On Monday, 29 April 2013 at 18:49:46 UTC, 1100110 wrote:


 In my opinion, don't even bother going to the zerobugs website.
 It'll be a long, boring, annoying waste of time.


 i don't. zerobugs source is on codeplex



Re: Arrays of functions, function signatures and template instantiation

2013-04-29 Thread anonymous

On Monday, 29 April 2013 at 23:49:18 UTC, JR wrote:
[...]

http://dpaste.dzfl.pl/9273fb92

Can't it be done neater than this? It *does* work now, but it's 
incredibly hacky and I'm not satisfied with it. The whole 
'passing a function pointer to a function that casts the 
signature and invokes it' deal makes me cringe. :


To get rid of the cast:

13c13
   void applyFunc(F* func, E[I][T] matrix) {
---

  void applyFunc(F func, E[I][T] matrix) {

16c16
   func(major, minor, element);
---

  func(major, minor, element);

29,30c29,30
   void run(T major, I minor, F* func) {
   (cast(void function(T,I))*func)(major, minor);
---

  void run(T major, I minor, F func) {
  func(major, minor);

52c52
   alias
MatrixWalker!(typeof(runner),typeof(funcyMatrix)).applyFunc apply;
---
  alias 
MatrixWalker!(typeof(runner),typeof(funcyMatrix)).applyFunc 
apply;


Re: debugging on Mac OSX

2013-04-29 Thread evilrat

On Tuesday, 30 April 2013 at 00:52:18 UTC, Timothee Cour wrote:
were you able to use it ? if so on which platforms? and does it 
provide

anything beyond what cgdb does?

On Mon, Apr 29, 2013 at 5:41 PM, evilrat evilrat...@gmail.com 
wrote:



On Monday, 29 April 2013 at 18:49:46 UTC, 1100110 wrote:



In my opinion, don't even bother going to the zerobugs 
website.

It'll be a long, boring, annoying waste of time.



i don't. zerobugs source is on codeplex


never used it myself. it's mainly for linux. and it depends on 
gtk2, so for ubuntu is no go, unless someone will port it to gtk3.