Re: Very vague compiler error message

2014-08-18 Thread Jeremy DeHaan via Digitalmars-d-learn
I didn't have access to my compute for longer than I thought, but I finally got around to this. After some messing around, I not only managed to track down the cause, but I got it fixed and the Audio module for DSFML is back to where it was. In one of my D classes, SoundStream, I defined a

Re: Static function at module level

2014-08-18 Thread bearophile via Digitalmars-d-learn
ketmar: other function declarations (methods, nested functions) accepts 'static', so why free functions shouldn't? For various reasons, one of them is that accepting useless code confuses newbies and doesn't allow them to build a correct model of the D semantics in their head. Bye,

Re: Using std.container.BinaryHeap like C++

2014-08-18 Thread Paulo Pinto via Digitalmars-d-learn
On Sunday, 17 August 2014 at 21:09:04 UTC, monarch_dodra wrote: On Sunday, 17 August 2014 at 18:54:27 UTC, Paulo Pinto wrote: Hi, I was wondering if it is possible to use the BinaryHeap store like the C++'s make_heap/pop_heap/push_heap functions. I would like to port to D some A* C++ code I

Re: Nullable instantiator anyone?

2014-08-18 Thread Nordlöw
On Monday, 18 August 2014 at 01:22:00 UTC, Ali Çehreli wrote: The following solution relies on an alias template parameter and a template constraint. The code covers both Nullable variants: import std.typecons; auto nullable(T)(T value) { return Nullable!T(value); } unittest { auto

Crash writing and reading back class instance address to void*

2014-08-18 Thread Remi Thebault via Digitalmars-d-learn
Hi Starting to use GtkD TreeModel, I write an instance of an abstract class to TreeIter.userData. When reading back the void pointer and casting to my abstract class leads to crash when instance is used (Task is the abstract class): int fillIter(TreeIter iter, Task t) {

Re: Crash writing and reading back class instance address to void*

2014-08-18 Thread FreeSlave via Digitalmars-d-learn
On Monday, 18 August 2014 at 10:07:30 UTC, Remi Thebault wrote: Hi Starting to use GtkD TreeModel, I write an instance of an abstract class to TreeIter.userData. When reading back the void pointer and casting to my abstract class leads to crash when instance is used (Task is the abstract

Re: Crash writing and reading back class instance address to void*

2014-08-18 Thread Remi Thebault via Digitalmars-d-learn
Classes are reference types. You take reference of local reference (it's address on stack). Use just cast(void*)t Thank you!

Re: String Prefix Predicate

2014-08-18 Thread Nordlöw
On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: I don't get it? If you use byDchar, you are *explicitly* decoding. How is that any better? If anything, you are *preventing* the (many) opportunities phobos has to *avoid* decoding when it can... byDchar and alikes are lazy

Re: String Prefix Predicate

2014-08-18 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 18 August 2014 at 11:28:25 UTC, Nordlöw wrote: On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: I don't get it? If you use byDchar, you are *explicitly* decoding. How is that any better? If anything, you are *preventing* the (many) opportunities phobos has to

Re: Using std.container.BinaryHeap like C++

2014-08-18 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 18 August 2014 at 06:50:08 UTC, Paulo Pinto wrote: On Sunday, 17 August 2014 at 21:09:04 UTC, monarch_dodra wrote: On Sunday, 17 August 2014 at 18:54:27 UTC, Paulo Pinto wrote: Hi, I was wondering if it is possible to use the BinaryHeap store like the C++'s

Re: Static function at module level

2014-08-18 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Aug 18, 2014 at 06:46:02AM +, bearophile via Digitalmars-d-learn wrote: ketmar: other function declarations (methods, nested functions) accepts 'static', so why free functions shouldn't? For various reasons, one of them is that accepting useless code confuses newbies and

goto skips declaration of variable

2014-08-18 Thread nrgyzer via Digitalmars-d-learn
Hi all, I've the following code snipped: import std.bigint; void main(string[] args) { BigInt i = 12345; if (args.length 1) { goto Exit; } i = BigInt(67890); Exit: return; } When I try to compile this sample

Re: Static function at module level

2014-08-18 Thread bearophile via Digitalmars-d-learn
H. S. Teoh: Is there a bug filed for this? Probably there is. But I stopped filing similar bugs because they seem to have a very low priority. Bye, bearophile

request assistance resolving curl related linker error

2014-08-18 Thread Andrew Edwards via Digitalmars-d-learn
import std.net.curl; void main(){} // Output: Undefined symbols for architecture x86_64: _curl_easy_cleanup, referenced from: _D3std3net4curl4Curl8shutdownMFZv in libphobos2.a(curl_3063_37c.o) _curl_easy_setopt, referenced from:

Re: goto skips declaration of variable

2014-08-18 Thread bearophile via Digitalmars-d-learn
nrgyzer: import std.bigint; void main(string[] args) { BigInt i = 12345; if (args.length 1) { goto Exit; } i = BigInt(67890); Exit: return; } When I try to compile this sample application I'm getting the

Re: goto skips declaration of variable

2014-08-18 Thread bearophile via Digitalmars-d-learn
It looks like a compiler bug https://issues.dlang.org/show_bug.cgi?id=13321 Bye, bearophile

Re: Static function at module level

2014-08-18 Thread Phil Lavoie via Digitalmars-d-learn
On Monday, 18 August 2014 at 06:46:03 UTC, bearophile wrote: ketmar: other function declarations (methods, nested functions) accepts 'static', so why free functions shouldn't? For various reasons, one of them is that accepting useless code confuses newbies and doesn't allow them to build a

Re: Static function at module level

2014-08-18 Thread Phil Lavoie via Digitalmars-d-learn
On Monday, 18 August 2014 at 05:29:53 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: On Mon, 18 Aug 2014 01:32:40 + Phil Lavoie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Ok, so after years of D usage I just noticed that this is valid D (compiles anyways):

Re: Static function at module level

2014-08-18 Thread Phil Lavoie via Digitalmars-d-learn
On Monday, 18 August 2014 at 14:23:47 UTC, bearophile wrote: H. S. Teoh: Is there a bug filed for this? Probably there is. But I stopped filing similar bugs because they seem to have a very low priority. Bye, bearophile I looked around for it but didn't find it. I filed this one:

Question about operations on class/struct properties

2014-08-18 Thread Uranuz via Digitalmars-d-learn
I think there is something that I don't understand about concept of *properties*. I thing that property is sort of object attribute that belongs to it. Currently property considered as two functions: *get* and/or *set*. So we can do two sort of operations on concept that called *property*:

Re: Ropes (concatenation trees) for strings in D ?

2014-08-18 Thread Justin Whear via Digitalmars-d-learn
On Thu, 14 Aug 2014 05:57:17 +, Carl Sturtivant wrote: This is the idea I mean. http://citeseer.ist.psu.edu/viewdoc/download? doi=10.1.1.14.9450rep=rep1type=pdf Here's a C++ implementation supported I think by gcc. http://www.sgi.com/tech/stl/Rope.html Is there a D implementation of a

Re: goto skips declaration of variable

2014-08-18 Thread ollie via Digitalmars-d-learn
On Mon, 18 Aug 2014 13:51:12 +, nrgyzer wrote: When I try to compile this sample application I'm getting the following error: sample.d(7): Error: goto skips declaration of variable sample.main.__ctmp1344 at sample.d(9) http://dlang.org/changelog.html#disable_goto_skips_init First

Re: request assistance resolving curl related linker error

2014-08-18 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 18 August 2014 at 14:24:54 UTC, Andrew Edwards wrote: import std.net.curl; void main(){} // Output: Undefined symbols for architecture x86_64: _curl_easy_cleanup, referenced from: The problem here is that std.net.curl is based on libcurl, so you need to link your program

Re: request assistance resolving curl related linker error

2014-08-18 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 18 August 2014 at 16:09:04 UTC, Martin Nowak wrote: The problem here is that std.net.curl is based on libcurl, so you need to link your program against it. Add '-L-lcurl' to your dmd invocation to do this. I also added an enhancement request to load curl at runtime.

simple question about function call syntax

2014-08-18 Thread Nikolay via Digitalmars-d-learn
I found this code sample in vibe: void connect(NetworkAddress addr) { enforce(.connect(m_ctx.socketfd, addr.sockAddr, addr.sockAddrLen) == 0, Failed to connect UDP socket.~to!string(getLastSocketError())); } What does mean .connect? Where I can find description of this

Re: simple question about function call syntax

2014-08-18 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Monday, 18 August 2014 at 16:30:13 UTC, Nikolay wrote: I found this code sample in vibe: void connect(NetworkAddress addr) { enforce(.connect(m_ctx.socketfd, addr.sockAddr, addr.sockAddrLen) == 0, Failed to connect UDP socket.~to!string(getLastSocketError())); } What

Re: Question about operations on class/struct properties

2014-08-18 Thread anonymous via Digitalmars-d-learn
On Monday, 18 August 2014 at 15:35:26 UTC, Uranuz wrote: date.day++; date.day -= 5; Should be treated as: date.day = date.day + 1; date.day = date.day - 5; if the were not oveloaded. So if we have get and set property methods I see that it could be calculated and this should working. This

beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
Hi there. Brief introduction, and a beginner's question. I just started playing with D a couple of weeks ago. I have been programming in C on and off since the late 80s, but I do finance for a living and my programming skills grew rusty. I have a bit more time now to catch up with

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
Thank to jwhear on irc who solved it for me despite claiming not to be a pyd guru. In case it's of benefit, here is what works: module hellostruct; import pyd.pyd; import std.stdio; import std.conv; struct t_mystruct { int i; string s; }; t_mystruct hellostruct(int[] inp) { int i;

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-18 at 16:39 +, Laeeth Isharc via Digitalmars-d-learn wrote: Hi there. Brief introduction, and a beginner's question. I just started playing with D a couple of weeks ago. I have been programming in C on and off since the late 80s, but I do finance for a living and my

Re: Using std.container.BinaryHeap like C++

2014-08-18 Thread Paulo Pinto via Digitalmars-d-learn
Am 18.08.2014 14:49, schrieb monarch_dodra: On Monday, 18 August 2014 at 06:50:08 UTC, Paulo Pinto wrote: On Sunday, 17 August 2014 at 21:09:04 UTC, monarch_dodra wrote: On Sunday, 17 August 2014 at 18:54:27 UTC, Paulo Pinto wrote: Hi, I was wondering if it is possible to use the BinaryHeap

Re: Static function at module level

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Mon, 18 Aug 2014 06:46:02 + bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: accepting useless code confuses newbies i think that i'm not really a newbie now ;-), but i'm still used to declare various private module functions and variables as 'static'. yes,

Re: goto skips declaration of variable

2014-08-18 Thread Ali Çehreli via Digitalmars-d-learn
On 08/18/2014 09:07 AM, ollie wrote: On Mon, 18 Aug 2014 13:51:12 +, nrgyzer wrote: When I try to compile this sample application I'm getting the following error: sample.d(7): Error: goto skips declaration of variable sample.main.__ctmp1344 at sample.d(9)

Re: goto skips declaration of variable

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Mon, 18 Aug 2014 13:51:12 + nrgyzer via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: When I try to compile this sample application I'm getting the following error: sample.d(7): Error: goto skips declaration of variable sample.main.__ctmp1344 at sample.d(9) it's

Re: Static function at module level

2014-08-18 Thread Phil Lavoie via Digitalmars-d-learn
On Monday, 18 August 2014 at 17:42:37 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 18 Aug 2014 06:46:02 + bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: accepting useless code confuses newbies i think that i'm not really a newbie now ;-), but i'm still

Re: simple question about function call syntax

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Mon, 18 Aug 2014 16:30:12 + Nikolay via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: What does mean .connect? Where I can find description of this syntax (dot + function name)? right here: http://dlang.org/expression.html#PrimaryExpression language documentation rulez!

Re: Static function at module level

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Mon, 18 Aug 2014 17:55:01 + Phil Lavoie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I don't think he meant you personally. ah, nothing personal, i just described my use case, maybe using some vague wording. i AM a newbie in D, there is nothing insulting in being

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-18 at 17:17 +, Laeeth Isharc via Digitalmars-d-learn wrote: Thank to jwhear on irc who solved it for me despite claiming not to be a pyd guru. :-) […] distutils.util.get_platform(), […] Does os.uname() not provide sufficient information? […] print mystruct.i

Re: Question about operations on class/struct properties

2014-08-18 Thread Phil Lavoie via Digitalmars-d-learn
All you said makes sense. If there is a direct connection between getter, setter and member than yes, returning it by reference is usually more convenient: private T _member; @property ref inout(T) member() inout {return _member;} However, sometimes, there is no direct connection between

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
All the cool folk doing data analysis and visualization using Python no longer bother with hand written C (*) for when pure Python won't cut the mustard. If Numba can't do the job, then Cython gets used. I have all my computational pure Python source codes running as fast as C these days

Re: Question about operations on class/struct properties

2014-08-18 Thread Uranuz via Digitalmars-d-learn
On Monday, 18 August 2014 at 18:07:09 UTC, Phil Lavoie wrote: All you said makes sense. If there is a direct connection between getter, setter and member than yes, returning it by reference is usually more convenient: private T _member; @property ref inout(T) member() inout {return _member;}

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 18 August 2014 at 18:08:59 UTC, Russel Winder via Digitalmars-d-learn wrote: […] distutils.util.get_platform(), […] Does os.uname() not provide sufficient information? This was boilerplate generated by pyd.

Re: Question about operations on class/struct properties

2014-08-18 Thread Uranuz via Digitalmars-d-learn
I posted it suddenly. I don't know why. I'll give short illustration. struct PropType { void append(int value) { //implementation } } class Test { PropType myProp() @property { return _propValue; } private PropType _propValue; } void main() { Test test

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-18 at 19:00 +, Laeeth Isharc via Digitalmars-d-learn wrote: On Monday, 18 August 2014 at 18:08:59 UTC, Russel Winder via Digitalmars-d-learn wrote: […] distutils.util.get_platform(), […] Does os.uname() not provide sufficient information? This was

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-18 at 18:59 +, Laeeth Isharc via Digitalmars-d-learn wrote: […] Thanks for the colour - I appreciate it. I have played with numba and pypy with numpy and it seems a powerful tool for some kinds of jobs. Perhaps it is my relative unfamiliarity with python, but for the time

Re: String Prefix Predicate

2014-08-18 Thread Nordlöw
On Monday, 18 August 2014 at 12:42:25 UTC, monarch_dodra wrote: On Monday, 18 August 2014 at 11:28:25 UTC, Nordlöw wrote: On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote: I don't get it? If you use byDchar, you are *explicitly* decoding. How is that any better? If anything,

In the new D release why use free functions instead of properties?

2014-08-18 Thread Gary Willoughby via Digitalmars-d-learn
In the new D release there have been some changes regarding built-in types. http://dlang.org/changelog.html?2.066#array_and_aa_changes I would like to learn why this has been done like this and why it is desired to be free functions rather than properties?

Re: In the new D release why use free functions instead of properties?

2014-08-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, 18 August 2014 at 21:02:09 UTC, Gary Willoughby wrote: In the new D release there have been some changes regarding built-in types. http://dlang.org/changelog.html?2.066#array_and_aa_changes I would like to learn why this has been done like this and why it is desired to be free

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 18 August 2014 at 19:28:55 UTC, Russel Winder via Digitalmars-d-learn wrote: On Mon, 2014-08-18 at 19:00 +, Laeeth Isharc via Digitalmars-d-learn wrote: On Monday, 18 August 2014 at 18:08:59 UTC, Russel Winder via Digitalmars-d-learn wrote: […]

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
Whilst the hardcore Pythonistas remain Pythonistas, some of the periphery has jumped ship to Go. Sadly D did not capture these folk, it perhaps should have done. It would be easy to blame fadism, but I think the actual reasons are far less superficial. So I gather that you agree that what

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Laeeth Isharc via Digitalmars-d-learn
Dr Russel Winder 41 Buckmaster Road London SW11 1EN, UK Are there any D users groups/meetups in London? I see you are not far away (I am in Barnes). Laeeth

Whath the heck does this do?

2014-08-18 Thread Brian Schott via Digitalmars-d-learn
alias extern(Windows) HRESULT fnNtQuerySystemInformation( uint SystemInformationClass, void* info, uint infoLength, uint* ReturnLength ) nothrow; If you know, respond here or at the following bug report: https://issues.dlang.org/show_bug.cgi?id=13309

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread bachmeier via Digitalmars-d-learn
On Monday, 18 August 2014 at 23:12:28 UTC, Laeeth Isharc wrote: For me, NumPy has some serious problems despite being the accepted norm for computational work. If not too offtopic, do you have a link describing, or would you briefly summarize these problems? I am intrigued. And what would

Re: In the new D release why use free functions instead of properties?

2014-08-18 Thread Idan Arye via Digitalmars-d-learn
On Monday, 18 August 2014 at 21:17:11 UTC, Jonathan M Davis wrote: On Monday, 18 August 2014 at 21:02:09 UTC, Gary Willoughby wrote: In the new D release there have been some changes regarding built-in types. http://dlang.org/changelog.html?2.066#array_and_aa_changes I would like to learn

Re: request assistance resolving curl related linker error

2014-08-18 Thread Andrew Edwards via Digitalmars-d-learn
On 8/19/14, 1:09 AM, Martin Nowak wrote: On Monday, 18 August 2014 at 14:24:54 UTC, Andrew Edwards wrote: import std.net.curl; void main(){} // Output: Undefined symbols for architecture x86_64: _curl_easy_cleanup, referenced from: The problem here is that std.net.curl is based on

Re: In the new D release why use free functions instead of properties?

2014-08-18 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 00:54:25 UTC, Idan Arye wrote: On Monday, 18 August 2014 at 21:17:11 UTC, Jonathan M Davis wrote: On Monday, 18 August 2014 at 21:02:09 UTC, Gary Willoughby wrote: In the new D release there have been some changes regarding built-in types.

Re: request assistance resolving curl related linker error

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Tue, 19 Aug 2014 09:56:30 +0900 Andrew Edwards via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Add '-L-lcurl' to your dmd invocation to do this. Okay, got it. Thank you much. or you can add pragma(lib, curl); to your source file if you are using dmd. signature.asc

Re: request assistance resolving curl related linker error

2014-08-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 02:24:48 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 19 Aug 2014 09:56:30 +0900 Andrew Edwards via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Add '-L-lcurl' to your dmd invocation to do this. Okay, got it. Thank you much. or you can add

Re: simple question about function call syntax

2014-08-18 Thread Nikolay via Digitalmars-d-learn
right here: http://dlang.org/expression.html#PrimaryExpression language documentation rulez! ;-) Yes I found it. Correct link: Module Scope Operator http://dlang.org/module.html

Re: request assistance resolving curl related linker error

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Tue, 19 Aug 2014 03:37:23 + Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: And Windows. Since, apparently, pragma(lib) is only supported by COFF and OMF. nope, GNU/Linux DMD supports it too (at least 32-bit version). signature.asc Description: PGP

Re: simple question about function call syntax

2014-08-18 Thread ketmar via Digitalmars-d-learn
On Tue, 19 Aug 2014 03:36:26 + Nikolay via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: right here: http://dlang.org/expression.html#PrimaryExpression language documentation rulez! ;-) Yes I found it. Correct link: Module Scope Operator http://dlang.org/module.html

Re: request assistance resolving curl related linker error

2014-08-18 Thread Andrew Edwards via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 02:24:48 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 19 Aug 2014 09:56:30 +0900 Andrew Edwards via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Add '-L-lcurl' to your dmd invocation to do this. Okay, got it. Thank you much. or you can add

Re: London D User Group [was beginner's pyd question - exporting structs to python]

2014-08-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-18 at 23:16 +, Laeeth Isharc via Digitalmars-d-learn wrote: Are there any D users groups/meetups in London? I see you are not far away (I am in Barnes). Crickey, that is just round the corner . :-) Yes there is a London D user group, it just hasn't met as yet. I

Re: beginner's pyd question - exporting structs to python

2014-08-18 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-18 at 23:12 +, Laeeth Isharc via Digitalmars-d-learn wrote: Whilst the hardcore Pythonistas remain Pythonistas, some of the periphery has jumped ship to Go. Sadly D did not capture these folk, it perhaps should have done. It would be easy to blame fadism, but I think