std.utf.decode(dlang, 1)

2014-09-18 Thread Algo via Digitalmars-d-learn
void main() { import std.utf; decode(dlang, 1); } Error: template std.utf.decode cannot deduce function from argument types !()(string, int), candidates are: D:\msc\D\dmd2\windows\bin\..\..\src\phobos\std\utf.d(924): std.utf.decode(S)(auto ref S str, ref size_t index) if

Re: std.utf.decode(dlang, 1)

2014-09-18 Thread Algo via Digitalmars-d-learn
On Thursday, 18 September 2014 at 06:09:54 UTC, Algo wrote: void main() { import std.utf; decode(dlang, 1); } Error: template std.utf.decode cannot deduce function from argument types !()(string, int), candidates are: D:\msc\D\dmd2\windows\bin\..\..\src\phobos\std\utf.d(924):

Re: Interop with C++ library - what toolchain do you use?

2014-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 18/09/14 00:28, Cliff wrote: So I am trying to use a C++ library with D. My toolchain is currently Visual Studio 2013 with Visual D, using the DMD compiler. When trying to link, I obviously ran into the OMF vs. COFF issue DMD has always produce COFF for Windows 64bit. Recently it also got

Re: std.utf.decode(dlang, 1)

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/17/2014 11:23 PM, Algo wrote: On Thursday, 18 September 2014 at 06:09:54 UTC, Algo wrote: void main() { import std.utf; decode(dlang, 1); } Error: template std.utf.decode cannot deduce function from argument types !()(string, int), candidates are:

Re: GC-less Hash-Tables (AA)

2014-09-18 Thread Nordlöw
On Wednesday, 17 September 2014 at 23:57:03 UTC, H. S. Teoh via Digitalmars-d-learn wrote: compile-time type information via templates. Ideally it should be a fully-decoupled library implementation interfacing with the compiler via a set API, but we're still some ways off from that right now.

Re: Interop with C++ library - what toolchain do you use?

2014-09-18 Thread Szymon Gatner via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 22:28:44 UTC, Cliff wrote: So I am trying to use a C++ library with D. My toolchain is currently Visual Studio 2013 with Visual D, using the DMD compiler. When trying to link, I obviously ran into the OMF vs. COFF issue, which makes using the C++ library a

Re: input range from stdin

2014-09-18 Thread krzaq via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 18:05:36 UTC, Ali Çehreli wrote: On 09/17/2014 08:30 AM, krzaq wrote: On Wednesday, 17 September 2014 at 14:37:21 UTC, Marc Schütz wrote: On Wednesday, 17 September 2014 at 12:44:00 UTC, krzaq wrote: I'd like to have something similar to C++'s

Re: GC-less Hash-Tables (AA)

2014-09-18 Thread Nordlöw
See our hashmap and hashset implementations here: https://github.com/economicmodeling/containers/tree/master/src/containers These containers are all certified GC-free. I get loads of erros on DMD 2.066: memory/allocators.d(81,4): Error: pure function

Re: GC-less Hash-Tables (AA)

2014-09-18 Thread Nordlöw
On Thursday, 18 September 2014 at 10:21:29 UTC, Nordlöw wrote: These containers are all certified GC-free. I get loads of erros on DMD 2.066: My mistake. I hade accidentally used another version of std.allocator.

Re: dub can't read files from cache

2014-09-18 Thread Kagamin via Digitalmars-d-learn
Windows has full support for unicode, since it's an OS based on unicode. It's old C code, which is not unicode-ready, and it remains not unicode-ready without changing behavior. Modern code like phobos usually tries to be unicode-ready.

Re: input range from stdin

2014-09-18 Thread via Digitalmars-d-learn
On Thursday, 18 September 2014 at 09:21:17 UTC, krzaq wrote: That's not what I wanted. Maybe I should explain instead of expecting you to divine my intentions, though :) I am trying to rewrite the following program in D--making it more elegant:

Re: input range from stdin

2014-09-18 Thread krzaq via Digitalmars-d-learn
On Thursday, 18 September 2014 at 11:13:36 UTC, Marc Schütz wrote: On Thursday, 18 September 2014 at 09:21:17 UTC, krzaq wrote: That's not what I wanted. Maybe I should explain instead of expecting you to divine my intentions, though :) I am trying to rewrite the following program in D--making

Re: std.utf.decode(dlang, 1)

2014-09-18 Thread AsmMan via Digitalmars-d-learn
On Thursday, 18 September 2014 at 06:09:54 UTC, Algo wrote: void main() { import std.utf; decode(dlang, 1); } Error: template std.utf.decode cannot deduce function from argument types !()(string, int), candidates are: D:\msc\D\dmd2\windows\bin\..\..\src\phobos\std\utf.d(924):

Re: input range from stdin

2014-09-18 Thread via Digitalmars-d-learn
On Thursday, 18 September 2014 at 13:10:06 UTC, krzaq wrote: I guess this works for now http://dpaste.dzfl.pl/6801615160e3 I have a follow-up question: why does zip not accept an array? Because (fixed-sized) arrays don't have a range interface (empty, front popFront()), in particular,

Re: dub can't read files from cache

2014-09-18 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Thursday, 18 September 2014 at 10:45:24 UTC, Kagamin wrote: Windows has full support for unicode, since it's an OS based on unicode. It's old C code, which is not unicode-ready, and it remains not unicode-ready without changing behavior. Modern code like phobos usually tries to be

Re: dub can't read files from cache

2014-09-18 Thread ketmar via Digitalmars-d-learn
On Thu, 18 Sep 2014 15:53:02 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Seriously, console application (in Russian lang. Windows) is not unicode-ready. that's 'cause authors tend to ignore W-functions. but GNU/Linux is not better, 'cause authors tend

Re: dub can't read files from cache

2014-09-18 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Thursday, 18 September 2014 at 16:05:15 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 18 Sep 2014 15:53:02 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Seriously, console application (in Russian lang. Windows) is not unicode-ready. that's

Re: dub can't read files from cache

2014-09-18 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Thursday, 18 September 2014 at 16:05:15 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 18 Sep 2014 15:53:02 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Seriously, console application (in Russian lang. Windows) is not unicode-ready. that's

Re: dub can't read files from cache

2014-09-18 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Thursday, 18 September 2014 at 16:05:15 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 18 Sep 2014 15:53:02 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Seriously, console application (in Russian lang. Windows) is not unicode-ready. that's

Re: Interop with C++ library - what toolchain do you use?

2014-09-18 Thread Cliff via Digitalmars-d-learn
On Thursday, 18 September 2014 at 08:27:07 UTC, Szymon Gatner wrote: On Wednesday, 17 September 2014 at 22:28:44 UTC, Cliff wrote: So I am trying to use a C++ library with D. My toolchain is currently Visual Studio 2013 with Visual D, using the DMD compiler. When trying to link, I obviously

Re: dub can't read files from cache

2014-09-18 Thread ketmar via Digitalmars-d-learn
On Thu, 18 Sep 2014 16:31:08 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: one ring to rule them all UTF-8 = Lord of the encodings. i want 42th symbol from the string. what? what do you mean saying that i must scan the whole string from the beginning to

Re: dub can't read files from cache

2014-09-18 Thread ketmar via Digitalmars-d-learn
On Thu, 18 Sep 2014 16:24:17 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: You can choice encoding for console in Linux yes. and i chose koi8. yet many utilities tend to ignore my locale when reading files (hey, D compiler, i'm talking about you!). i

Re: dub can't read files from cache

2014-09-18 Thread AsmMan via Digitalmars-d-learn
On Thursday, 18 September 2014 at 16:51:06 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 18 Sep 2014 16:31:08 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: one ring to rule them all UTF-8 = Lord of the encodings. i want 42th symbol from the string.

Re: dub can't read files from cache

2014-09-18 Thread AsmMan via Digitalmars-d-learn
On Thursday, 18 September 2014 at 16:49:14 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 18 Sep 2014 16:24:17 + Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: You can choice encoding for console in Linux yes. and i chose koi8. yet many utilities tend

Re: input range from stdin

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2014 02:21 AM, krzaq wrote: That's not what I wanted. Maybe I should explain instead of expecting you to divine my intentions, though :) And quietly ignored some of the things you were doing. :) For example, I did not think it was necessary to fill an existing array when the range

Re: input range from stdin

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2014 11:22 AM, Ali Çehreli wrote: And quietly ignored And *I* quietly ignored Ali

Re: dub can't read files from cache

2014-09-18 Thread ketmar via Digitalmars-d-learn
On Thu, 18 Sep 2014 18:14:36 + AsmMan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I didn't know about this encoding. Why should you use KOI8-R instead of UTF-8? what does it conver that UTF-8 didn't? I used to think UTF-8 does conver all the alphabets around,

Re: dub can't read files from cache

2014-09-18 Thread ketmar via Digitalmars-d-learn
On Thu, 18 Sep 2014 21:26:27 +0300 ketmar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: btw, D lexer tries to validate even shebangs. WUT?! why can't i put non-utf8 text in shebang? ah, it's utf-8 or die again, i see... signature.asc Description: PGP signature

Why is amap implemented as a member function of TaskPool?

2014-09-18 Thread Atila Neves via Digitalmars-d-learn
Or what I really want to ask: why can't I call amap from std.parallelism with a lambda? I assume it's because it's a member function but I'm not 100% sure. I hardly ever call map with a named function (named local functions don't work with TaskPool.amap either), it's always a closure. Not

Re: Why is amap implemented as a member function of TaskPool?

2014-09-18 Thread Jared via Digitalmars-d-learn
On Thursday, 18 September 2014 at 19:49:00 UTC, Atila Neves wrote: Or what I really want to ask: why can't I call amap from std.parallelism with a lambda? I assume it's because it's a member function but I'm not 100% sure. Atila You have to tell DMD that the lambda is not in fact a

String[] pointer to void* and back

2014-09-18 Thread seany via Digitalmars-d-learn
Consider this snippet: import std.stdio; import std.conv; import core.vararg; void main() { string[] s = [aa, bb, cc]; string []* ss; void * v; ss = s; v = cast(void*)s; ss = cast(string[]*) v; s = *ss; writeln(s); } This fails, Stack

Trouble with std.Variant

2014-09-18 Thread ddos via Digitalmars-d-learn
struct Vec2 { float[2] vec; public float length() { return sqrt(vec[0]*vec[0]+vec[1]*vec[1]); } } int main(string[] argv) { Vec2 test; Variant v = test; return 0; }

Re: Trouble with std.Variant

2014-09-18 Thread ddos via Digitalmars-d-learn
The following code fails because Vec2.length() does not return int ... so Variant is only usable with types that do not have a method with name length() ?? i'm confused On Thursday, 18 September 2014 at 21:03:47 UTC, ddos wrote: struct Vec2 { float[2] vec; public float

Re: String[] pointer to void* and back

2014-09-18 Thread seany via Digitalmars-d-learn
Found, it should have been v = cast(void*)ss; sorry.

Re: Trouble with std.Variant

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2014 02:06 PM, ddos wrote: The following code fails because Vec2.length() does not return int ... so Variant is only usable with types that do not have a method with name length() ?? i'm confused On Thursday, 18 September 2014 at 21:03:47 UTC, ddos wrote: struct Vec2 { float[2]

Re: String[] pointer to void* and back

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2014 01:59 PM, seany wrote: string[] s = [aa, bb, cc]; string []* ss; void * v; ss = s; v = cast(void*)s; Not s, but its address should be assigned to v: v = cast(void*)s; Only then it will match its reverse operation: ss =

Re: String[] pointer to void* and back

2014-09-18 Thread seany via Digitalmars-d-learn
Yes, thank you, I corrected that. However, if this v is a member of a class, like import std.stdio; import std.conv; import core.vararg; struct S { void *v; } class C { S* sx = new S; void dothings() { string[] ss = [1, 2, 4]; string[] *s; void *vv; s =

Re: String[] pointer to void* and back

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2014 02:35 PM, seany wrote: struct S { void *v; } class C { S* sx = new S; void dothings() { string[] ss = [1, 2, 4]; Note that ss is a local variable of a druntime type equivalent of the following: struct D_Slice_of_strings_ { size_t

Re: String[] pointer to void* and back

2014-09-18 Thread seany via Digitalmars-d-learn
what if i needed to access many such runtime variables of many types, and did not want to create a member for each type?

Re: String[] pointer to void* and back

2014-09-18 Thread anonymous via Digitalmars-d-learn
On Thursday, 18 September 2014 at 21:35:50 UTC, seany wrote: Yes, thank you, I corrected that. However, if this v is a member of a class, like import std.stdio; import std.conv; import core.vararg; struct S { void *v; } class C { S* sx = new S; void dothings() {

Re: String[] pointer to void* and back

2014-09-18 Thread bearophile via Digitalmars-d-learn
anonymous: Here, the pointer to the stack escapes the function. Don't do that! Hopefully the D type system will be improved with scoping tracking management, to turn similar operations into compilation errors (as in Rust, but perhaps in a less refined way). Bye, bearophile

Re: String[] pointer to void* and back

2014-09-18 Thread Ali Çehreli via Digitalmars-d-learn
On 09/18/2014 02:52 PM, seany wrote: what if i needed to access many such runtime variables of many types, and did not want to create a member for each type? If you are holding an address in a void*, you must make sure that the original object is still at that location when you attempt to

linux ipv4 multicast

2014-09-18 Thread james via Digitalmars-d-learn
I just started doing D networking today, so I may just be doing something wrong / stupid but I can not find the ip_mreq struct anywhere. I ended up just making my own in my module struct ip_mreq { in_addr imr_multiaddr; in_addr imr_interface; } And then I was able to