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

2014-09-17 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: D:\msc\D\dmd2\windows\bin\.

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

2014-09-17 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-17 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): std.u

std.utf.decode("dlang", 1)

2014-09-17 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 (!isSomeStr

Re: Dirilect3 Installation Step by Step

2014-09-17 Thread Rikki Cattermole via Digitalmars-d-learn
On Thursday, 18 September 2014 at 00:06:41 UTC, fuijiy wrote: Hello guys, I'm trying to install Derelict3. I read a lot of thing and I lost myself between this huge set of information. What I must do ? First, I try to build Derelict3 (github version) manually but I failed. So I tried with dub

Re: Link problem in std.regex with DMD git master

2014-09-17 Thread Nordlöw
On Thursday, 18 September 2014 at 00:38:33 UTC, Nordlöw wrote: I guess make install in Phobos is a bit to blame in this regard. I'll add some logic in my bash wrapper scripts that removes the installation of Phobos before the new is written there. I guess the same goes for druntime.

Re: Link problem in std.regex with DMD git master

2014-09-17 Thread Nordlöw
On Thursday, 18 September 2014 at 00:18:41 UTC, Vladimir Panteleev wrote: std.regex was recently split up into a package. Make sure your makefiles are up to date. My installation script for Phobos just copied (appended) to target directory. I guess it picked the old version of std.regex. Work

Re: Link problem in std.regex with DMD git master

2014-09-17 Thread Nordlöw
On Thursday, 18 September 2014 at 00:35:37 UTC, Nordlöw wrote: My installation script for Phobos just copied (appended) to target directory. I guess it picked the old version of I guess make install in Phobos is a bit to blame in this regard. I'll add some logic in my bash wrapper scripts that

Re: Link problem in std.regex with DMD git master

2014-09-17 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 23:46:13 UTC, Nordlöw wrote: Since a couple of days my DMD git master has start to error as below when I compiled programs that import std.regex. What's wrong? How are you building Phobos? std.regex was recently split up into a package. Make sure your makef

Dirilect3 Installation Step by Step

2014-09-17 Thread fuijiy via Digitalmars-d-learn
Hello guys, I'm trying to install Derelict3. I read a lot of thing and I lost myself between this huge set of information. What I must do ? First, I try to build Derelict3 (github version) manually but I failed. So I tried with dub. But I don't understand how to use dub. My OS is Ubuntu. Cou

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 17, 2014 at 11:43:27PM +, "Nordlöw" via Digitalmars-d-learn wrote: > On Wednesday, 17 September 2014 at 23:27:10 UTC, Nordlöw wrote: > >to check if we need to use GC. If not we can use malloc/free. > > Further if they key and values are all fixed-size we should probably > use some

Link problem in std.regex with DMD git master

2014-09-17 Thread Nordlöw
Since a couple of days my DMD git master has start to error as below when I compiled programs that import std.regex. What's wrong? dmd -vcolumns -debug -g -gs -unittest -wi -main conceptnet5.d /home/per/Work/justd/languages.d /home/per/Work/justd/algorithm_ex.d /home/per/Work/justd/dbg.d /ho

Re: Link problem in std.regex with DMD git master

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 23:46:13 UTC, Nordlöw wrote: Since a couple of days my DMD git master has start to error as below when I compiled programs that import std.regex. What's wrong? The error doesn't occur on DMD version 2.066.

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 17, 2014 at 11:27:08PM +, "Nordlöw" via Digitalmars-d-learn wrote: > On Wednesday, 17 September 2014 at 22:56:17 UTC, H. S. Teoh via > Digitalmars-d-learn wrote: > >Slots come from the GC heap, but in theory it could come from any > >allocator, potentially even malloc/free, since t

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 23:27:10 UTC, Nordlöw wrote: to check if we need to use GC. If not we can use malloc/free. Further if they key and values are all fixed-size we should probably use some allocator instead of malloc/free. That would make more efficient use of this allocation r

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 15:27:40 UTC, Justin Whear wrote: These containers are all certified GC-free. With the exception of getting keys and values arrays. Those return GC memory to the caller. I'm pretty sure it's documented that it does that though. Everything else uses allocator

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 22:56:17 UTC, H. S. Teoh via Digitalmars-d-learn wrote: Slots come from the GC heap, but in theory it could come from any allocator, potentially even malloc/free, since the lifetime of the Slots So I guess there is room for some optimizations here right? We

Re: Fibers

2014-09-17 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 10:00:49 UTC, Andrew Edwards wrote: Basically what I'm trying to do is to transact on every file in give directory at the same time exact time. In this exam, I'm removing the file/directory but that's just a test to see if I could get it to work. Perhaps th

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 17, 2014 at 10:44:17PM +, "Nordlöw" via Digitalmars-d-learn wrote: > On Wednesday, 17 September 2014 at 22:36:55 UTC, H. S. Teoh via > Digitalmars-d-learn wrote: > >So you would use malloc/free? > > Yes, with GC-free I mean *not* involving D's automatic garbage > collector for the

Re: liblzma bindings in dub

2014-09-17 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 21:05:07 UTC, Freddy wrote: How do you include liblzma bindings(https://github.com/D-Programming-Deimos/liblzma) in a dub project? as it's not on code.dlang.org, you will have to do it locally: cd yourChoiceofDirectory git clone https://github.com/D-Programmi

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 22:36:55 UTC, H. S. Teoh via Digitalmars-d-learn wrote: So you would use malloc/free? Yes, with GC-free I mean *not* involving D's automatic garbage collector for the individual allocations of the AA *keys* and *values*. How are these normally allocated in

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 17, 2014 at 10:26:16PM +, "Nordlöw" via Digitalmars-d-learn wrote: > On Wednesday, 17 September 2014 at 19:51:06 UTC, H. S. Teoh via > Digitalmars-d-learn wrote: > >How do you implement a completely GC-free AA with no limit on number > >of entries stored? I mean, where would it get

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 19:51:06 UTC, H. S. Teoh via Digitalmars-d-learn wrote: How do you implement a completely GC-free AA with no limit on number of entries stored? I mean, where would it get the memory to store the hashtable from? I mean, GC-free not heap-free. An AA of course

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

2014-09-17 Thread Cliff via Digitalmars-d-learn
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 bit of a trial to say the least (I played around with some lib for

Re: Fibers

2014-09-17 Thread Andrew Edwards via Digitalmars-d-learn
On 9/17/14, 9:43 PM, Kagamin wrote: fibs ~= new TestFiber(entry); should just work without accounting for number of items Kagamin/Flamencofantasy, thank you very much.

Re: Code doesn't work - why?

2014-09-17 Thread Cliff via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 21:45:01 UTC, Robin wrote: This is actually a good question as this code isn't really complex or doesn't require the best possible performance. But in case I will ever need optimum performance I should have learned how to handle tasks with value types which is

Re: Code doesn't work - why?

2014-09-17 Thread Robin via Digitalmars-d-learn
This is actually a good question as this code isn't really complex or doesn't require the best possible performance. But in case I will ever need optimum performance I should have learned how to handle tasks with value types which is the main reason why I chose them instead of reference types -

Re: Code doesn't work - why?

2014-09-17 Thread Cliff via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 21:33:01 UTC, Robin wrote: Here is the fully working code for everyone experiencing similar bugs or problems with pointers and value types. =) struct DeterministicState { public: this(string name, bool isFinal, DeterministicState *[char] transits...) {

Re: Code doesn't work - why?

2014-09-17 Thread Robin via Digitalmars-d-learn
Here is the fully working code for everyone experiencing similar bugs or problems with pointers and value types. =) struct DeterministicState { public: this(string name, bool isFinal, DeterministicState *[char] transits...) { this.name = name; this.finalState =

liblzma bindings in dub

2014-09-17 Thread Freddy via Digitalmars-d-learn
How do you include liblzma bindings(https://github.com/D-Programming-Deimos/liblzma) in a dub project?

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread bearophile via Digitalmars-d-learn
H. S. Teoh: How do you implement a completely GC-free AA with no limit on number of entries stored? Ada2012 has a fixed-size hash in the standard library, it can even be allocated on the stack. But the number of entries is not unlimited. Bye, bearophile

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 17, 2014 at 07:23:01PM +, "Nordlöw" via Digitalmars-d-learn wrote: > On Wednesday, 17 September 2014 at 15:27:40 UTC, Justin Whear wrote: > >These containers are all certified GC-free. > > Superb! > > One question though: > > AFAIK a builtin hash-table in D shouldn't require nor

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 19:39:16 UTC, Nordlöw wrote: On Wednesday, 17 September 2014 at 15:27:40 UTC, Justin Whear wrote: These containers are all certified GC-free. What'a the cost of using hashset in favour of hashmap if I want the to use the Range range() property?

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 15:27:40 UTC, Justin Whear wrote: These containers are all certified GC-free. What's the difference between std.containers.Array and DynamicArray? The RC?

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 15:27:40 UTC, Justin Whear wrote: These containers are all certified GC-free. Superb! One question though: AFAIK a builtin hash-table in D shouldn't require nor use any GC-allocations if the keys and values all have reference semantics right (no string cla

Re: input range from stdin

2014-09-17 Thread Ali Çehreli via Digitalmars-d-learn
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 std::istream_iterator(std::cin) Is it possible? I'm relatively indifferent to effic

Re: Code doesn't work - why?

2014-09-17 Thread Robin via Digitalmars-d-learn
Hiho, thank you for your response! You just showed me my flaws while programming with value types. I think the only close solution is to work with pointers to the created states within the associative array instead of direct value types. Thanks for clearing this up to me. =) Regards, Rob

Re: Code doesn't work - why?

2014-09-17 Thread Ali Çehreli via Digitalmars-d-learn
On 09/17/2014 03:42 AM, Robin wrote:> Hiho, > However, I still do not understand why it didn't work for struct value > types since I do not perform any mutations on the state objects during > execution of the code. I was a little sloppy with my response. :) What I suspected is still correct tho

Re: dub can't read files from cache

2014-09-17 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Tuesday, 16 September 2014 at 17:11:14 UTC, Ruslan wrote: Note. ╨а╤Г╤Б╨╗╨░╨╜ is a cyrillic word. That should not affect because dub only displays so. Если Вы программируете (не только на D), то Вам стоит сменить учетную запись на латинскую. От кириллической много проблем, в особенности из

Re: input range from stdin

2014-09-17 Thread krzaq via Digitalmars-d-learn
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 std::istream_iterator(std::cin) Is it possible? I'm relatively indifferent to efficiency of the solution. import std.

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Justin Whear via Digitalmars-d-learn
On Wed, 17 Sep 2014 10:39:05 +, Nordlöw wrote: > Have anybody cooked any GC-less variants of hash-tables (associative > arrays) that take keys and values with value semantics only. > > Similar to how > > X[] > > relates to > > std.containers.Array!X > > I need this to index my n

Re: dub can't read files from cache

2014-09-17 Thread Suliman via Digitalmars-d-learn
Is it's possible to change dub package cache dir?

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
On Wednesday, 17 September 2014 at 10:39:07 UTC, Nordlöw wrote: Have anybody cooked any GC-less variants of hash-tables (associative arrays) that take keys and values with value semantics only. Important follow-up question: If types of key and value all have value semantics (no indirections)

Re: input range from stdin

2014-09-17 Thread via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 12:44:00 UTC, krzaq wrote: I'd like to have something similar to C++'s std::istream_iterator(std::cin) Is it possible? I'm relatively indifferent to efficiency of the solution. import std.stdio; import std.algorithm; import std.conv; writeln(stdin.byLine.ma

Re: dub can't read files from cache

2014-09-17 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 12:08:51 UTC, Kagamin wrote: Looks like an error from the compiler, non-ascii characters in file path can affect it. Try raising an issue here: https://github.com/D-Programming-Language/dub/issues

Re: Why does this not work?

2014-09-17 Thread anonymous via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 13:20:15 UTC, Shachar wrote: On Wednesday, 17 September 2014 at 13:03:05 UTC, flamencofantasy wrote: the result of ubyte + ubyte is int I believe. Try; void func( int c ) { ubyte a; a = cast(ubyte)(cast(ubyte)c + cast(ubyte)c); } From http://dlang.o

Re: Why does this not work?

2014-09-17 Thread flamencofantasy via Digitalmars-d-learn
http://www.drdobbs.com/tools/value-range-propagation/229300211

Re: Why does this not work?

2014-09-17 Thread ketmar via Digitalmars-d-learn
On Wed, 17 Sep 2014 16:36:41 +0300 Shachar Shemesh via Digitalmars-d-learn wrote: > I don't understand. Why is this behavior preferrable to the one > outlined by the specs? 'cause C does exactly this. there is no reason to confuse people with C background by silently removing such feature. sign

Re: Why does this not work?

2014-09-17 Thread flamencofantasy via Digitalmars-d-learn
Because of overflow. On Wednesday, 17 September 2014 at 13:36:42 UTC, Shachar Shemesh wrote: On 17/09/14 16:32, ketmar via Digitalmars-d-learn wrote: On Wed, 17 Sep 2014 13:20:13 + Shachar via Digitalmars-d-learn wrote: From http://dlang.org/type, under Usual Arithmetic Conversions

Re: Why does this not work?

2014-09-17 Thread Shachar Shemesh via Digitalmars-d-learn
On 17/09/14 16:32, ketmar via Digitalmars-d-learn wrote: On Wed, 17 Sep 2014 13:20:13 + Shachar via Digitalmars-d-learn wrote: From http://dlang.org/type, under Usual Arithmetic Conversions: 4. Else the integer promotions are done on each operand, followed by: 1. If both are the sa

Re: Why does this not work?

2014-09-17 Thread ketmar via Digitalmars-d-learn
On Wed, 17 Sep 2014 13:20:13 + Shachar via Digitalmars-d-learn wrote: > From http://dlang.org/type, under Usual Arithmetic Conversions: > 4. Else the integer promotions are done on each operand, followed > by: > 1. If both are the same type, no more conversions are done. it's bug in sp

Re: Why does this not work?

2014-09-17 Thread Shachar via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 13:03:05 UTC, flamencofantasy wrote: the result of ubyte + ubyte is int I believe. Try; void func( int c ) { ubyte a; a = cast(ubyte)(cast(ubyte)c + cast(ubyte)c); } From http://dlang.org/type, under Usual Arithmetic Conversions: 4. Else the intege

Re: Why does this not work?

2014-09-17 Thread flamencofantasy via Digitalmars-d-learn
the result of ubyte + ubyte is int I believe. Try; void func( int c ) { ubyte a; a = cast(ubyte)(cast(ubyte)c + cast(ubyte)c); }

Re: Fibers

2014-09-17 Thread Kagamin via Digitalmars-d-learn
and fibs.length = count;

input range from stdin

2014-09-17 Thread krzaq via Digitalmars-d-learn
I'd like to have something similar to C++'s std::istream_iterator(std::cin) Is it possible? I'm relatively indifferent to efficiency of the solution.

Re: Fibers

2014-09-17 Thread Kagamin via Digitalmars-d-learn
fibs ~= new TestFiber(entry); should just work without accounting for number of items

Why does this not work?

2014-09-17 Thread Shachar via Digitalmars-d-learn
void func( int c ) { ubyte a; a = cast(ubyte)c + cast(ubyte)c; } dmd v2.065 complains about: test.d(5): Error: cannot implicitly convert expression (cast(int)cast(ubyte)c + cast(int)cast(ubyte)c) of type int to ubyte As far as I can tell, adding two values of the same type should re

Re: dub can't read files from cache

2014-09-17 Thread Kagamin via Digitalmars-d-learn
Looks like an error from the compiler, non-ascii characters in file path can affect it.

Re: Fibers

2014-09-17 Thread Flamencofantasy via Digitalmars-d-learn
if (++count >= fibs.length)... On Wednesday, 17 September 2014 at 10:00:49 UTC, Andrew Edwards wrote: The script below is borrowed form a unit test in core.thread and modified slightly. If fails with "segmentation fault: 11" but I'm not sure why. Basically what I'm trying to do is to transac

Re: Code doesn't work - why?

2014-09-17 Thread Robin via Digitalmars-d-learn
Hiho, thank you for your response on my topic. However, I still do not understand why it didn't work for struct value types since I do not perform any mutations on the state objects during execution of the code. The only thing happening with them is that they are getting copied bitwise and

GC-less Hash-Tables (AA)

2014-09-17 Thread Nordlöw
Have anybody cooked any GC-less variants of hash-tables (associative arrays) that take keys and values with value semantics only. Similar to how X[] relates to std.containers.Array!X I need this to index my nodes in graphs with tens of millions of nodes.

Build failed LuaD & vibe.d

2014-09-17 Thread Chris via Digitalmars-d-learn
DUB version 0.9.21 dmd version 2.065.0 vibe.d version 0.7.20 Since v0.7.19 vibe.d has vibe.utils.dictionarylist. This doesn't go well with LuaD's vibe.utils.dictionarylist (same goes for higher versions of dmd and vibe.d, see below) Compiling... source/luad/conversions/structs.d-mixin-38(38): E

Fibers

2014-09-17 Thread Andrew Edwards via Digitalmars-d-learn
The script below is borrowed form a unit test in core.thread and modified slightly. If fails with "segmentation fault: 11" but I'm not sure why. Basically what I'm trying to do is to transact on every file in give directory at the same time exact time. In this exam, I'm removing the file/dir

Re: compile "automation", makefile, or whatever?

2014-09-17 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 16 September 2014 at 21:54:10 UTC, bachmeier wrote: In my case, I'm calling libraries on my local machine that I wrote and I didn't use dub, but according to docs you can write "dependencies": { "mylib2": { "path": "../mylib2" } }, or something like that linking to existing

Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-17 Thread via Digitalmars-d-learn
On Tuesday, 16 September 2014 at 20:19:24 UTC, notna wrote: Thanks AsmMan, Found http://msdn.microsoft.com/en-us/library/windows/desktop/ms724432%28v=vs.85%29.aspx and with your help, now understand :) The syntax below prints a blank after my username, so the slice seems a bit too long :O S

Re: Template alias parameters to local variables

2014-09-17 Thread via Digitalmars-d-learn
On Saturday, 13 September 2014 at 11:34:01 UTC, Marc Schütz wrote: Consider the following code: alias Sink = scope void delegate(const(char)[]); private template generateAliases(int __i, __vars...) { import std.conv : to; static if(__i < __vars.length)