Re: Unicode arithmetic at run-time

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sat, 20 Sep 2014 22:12:52 -0700 Ali Çehreli via Digitalmars-d-learn wrote: > My unimportant contribution to this thread: It is actually uint in > this case. :) ah, sure. i just lost that 'u' somewhere... gotta find it. ;-) signature.asc Description: PGP signature

Re: Unicode arithmetic at run-time

2014-09-20 Thread Ali Çehreli via Digitalmars-d-learn
On 09/20/2014 08:14 PM, ketmar via Digitalmars-d-learn wrote: > arichmetics with dchars automatically coerces to int My unimportant contribution to this thread: It is actually uint in this case. :) Ali

Re: Unicode arithmetic at run-time

2014-09-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 21 September 2014 at 03:00:34 UTC, Charles McAnany wrote: writefln("%c", '/U0001F0A1'+1); // The problem here is just that arithmetic converts everything back to integers and writefln is a bit picky about types. You can print it though by casting it back to dchar: writefl

Re: Unicode arithmetic at run-time

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sun, 21 Sep 2014 03:00:32 + Charles McAnany via Digitalmars-d-learn wrote: can't this help: writefln("%c", cast(dchar)('\U0001F0A1'+1)); arichmetics with dchars automatically coerces to int, so you must cast result back to dchar. signature.asc Description: PGP signature

Unicode arithmetic at run-time

2014-09-20 Thread Charles McAnany via Digitalmars-d-learn
Friends, I note that there are playing cards in unicode: http://en.wikipedia.org/wiki/Playing_cards_in_Unicode They follow a nice pattern, so I can quickly convert from a rank and suit to the appropriate escape sequence in D. I'd like to automate this, but I can't seem to do arithmetic on unico

Re: destroy(someStruct)

2014-09-20 Thread Chris Cain via Digitalmars-d-learn
On Saturday, 20 September 2014 at 22:46:10 UTC, John Colvin wrote: import core.stdc.stdio; struct S { ~this() { printf("%x\n".ptr, &this); } } void main() { S* sp = new S; destroy(*sp); S s; destroy(s); auto sa = ne

Re: enum-indexed arrays

2014-09-20 Thread Nordlöw
On Saturday, 20 September 2014 at 22:13:30 UTC, Baz wrote: Not true, because you can use std.traits.EnumMembers to prepare an enum member rank lookup table, so that values have even not be consecutive. You're correct. Even better not having that limitation :) there is an example here: http:

Re: How does GC.addRange work?

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sat, 20 Sep 2014 22:21:13 + Gary Willoughby via Digitalmars-d-learn wrote: > So zeroing values will inform the GC the reference has gone? yes. signature.asc Description: PGP signature

destroy(someStruct)

2014-09-20 Thread John Colvin via Digitalmars-d-learn
import core.stdc.stdio; struct S { ~this() { printf("%x\n".ptr, &this); } } void main() { S* sp = new S; destroy(*sp); S s; destroy(s); auto sa = new S[2]; foreach(ref s_; sa) destroy(s_); }

Re: How does GC.addRange work?

2014-09-20 Thread Gary Willoughby via Digitalmars-d-learn
On Saturday, 20 September 2014 at 20:44:18 UTC, ketmar via Digitalmars-d-learn wrote: note that scan is conservative, so if you happen to have some integer value that can be interpreted as pointer to GC-managed memory, it will be considered as pointer. So zeroing values will inform the GC the

Re: enum-indexed arrays

2014-09-20 Thread Baz via Digitalmars-d-learn
On Saturday, 20 September 2014 at 22:00:24 UTC, bearophile wrote: Nordlöw: should be Enumerator start = Enumerator.min This also requires the enum to have adjacent values (in general enums can skip values). Bye, bearophile Not true, because you can use std.traits.EnumMembers to prepa

Re: enum-indexed arrays

2014-09-20 Thread bearophile via Digitalmars-d-learn
Nordlöw: should be Enumerator start = Enumerator.min This also requires the enum to have adjacent values (in general enums can skip values). Bye, bearophile

Re: enum-indexed arrays

2014-09-20 Thread Nordlöw
On Saturday, 20 September 2014 at 21:05:12 UTC, Nordlöw wrote: On Saturday, 20 September 2014 at 20:43:28 UTC, bearophile wrote: In D currently that "int[I]" is an associative array with I index and int values. So in another post I have suggested another syntax. Couldn't we simply add an opti

Re: enum-indexed arrays

2014-09-20 Thread Nordlöw
On Saturday, 20 September 2014 at 20:43:28 UTC, bearophile wrote: In D currently that "int[I]" is an associative array with I index and int values. So in another post I have suggested another syntax. Couldn't we simply add an optimization pass that CT-introspects the enumerators of an enum-in

Re: pop & popFront combined

2014-09-20 Thread Ali Çehreli via Digitalmars-d-learn
On 09/20/2014 11:59 AM, "Nordlöw" wrote: Is there a reason why popFront doesn't automatically return what front does? If so I'm still missing a combined variant of pop and popFront in std.range. Why isn't such a common operation in Phobos already? It is also related to exception safety. It too

Re: enum-indexed arrays

2014-09-20 Thread bearophile via Digitalmars-d-learn
Nordlöw: Have anybody thought about adding safe enum-based indexing to builtin arrays? Ada has this. I'd like this. I'd like even more: a general way to have optionally strongly typed array indexes. enum I { a=3,b=4,c=5 } int[I] x = [3,4,5]; In D currently that "int[I]" is an as

Re: How does GC.addRange work?

2014-09-20 Thread ketmar via Digitalmars-d-learn
On Sat, 20 Sep 2014 20:14:35 + Gary Willoughby via Digitalmars-d-learn wrote: > How does GC.addRange work? i.e. what is it doing? I'm assuming > reading the docs that it adds a range for the GC to scan but what > actually happens? Does the GC look into this range and check for > the existe

enum-indexed arrays

2014-09-20 Thread Nordlöw
Have anybody thought about adding safe enum-based indexing to builtin arrays? Ada has this. IMHO I believe this could be implemented either in the compiler, druntime or phobos. Example enum I { a=3,b=4,c=5 } int[I] x = [3,4,5]; assert(x[I.a] == 3); assert(x[I.b] == 4); as

Re: how to create and compile reesources for dmd 64

2014-09-20 Thread Cassio Butrico via Digitalmars-d-learn
On Saturday, 20 September 2014 at 20:33:36 UTC, Cassio Butrico wrote: On Saturday, 20 September 2014 at 15:24:23 UTC, K.K. wrote: On Friday, 19 September 2014 at 22:20:59 UTC, Cassio Butrico wrote: Hello everyone, When I create and compile resouces to 32 works perfect, but when I try to compil

Re: how to create and compile reesources for dmd 64

2014-09-20 Thread Cassio Butrico via Digitalmars-d-learn
On Saturday, 20 September 2014 at 15:24:23 UTC, K.K. wrote: On Friday, 19 September 2014 at 22:20:59 UTC, Cassio Butrico wrote: Hello everyone, When I create and compile resouces to 32 works perfect, but when I try to compilat of 64 error LNK1136: invalid or corrupt file. I do not know if it h

How does GC.addRange work?

2014-09-20 Thread Gary Willoughby via Digitalmars-d-learn
How does GC.addRange work? i.e. what is it doing? I'm assuming reading the docs that it adds a range for the GC to scan but what actually happens? Does the GC look into this range and check for the existence of pointers it's currently managing? For example, if i nulled a pointer in the range i

Re: pop & popFront combined

2014-09-20 Thread Nordlöw
On Saturday, 20 September 2014 at 19:23:46 UTC, Jakob Ovrum wrote: Sometimes after popping, the previous `front` is no longer valid, such as in the case of a buffer being reused. We should be careful about promoting using a previously read `front` after `popFront` until we figure out what we wa

Re: regex problems

2014-09-20 Thread AsmMan via Digitalmars-d-learn
On Saturday, 20 September 2014 at 15:28:54 UTC, seany wrote: consider this: import std.conv, std.algorithm; import core.vararg; import std.stdio, std.regex; void main() { string haystack = "ID : generateWorld; Position : { &

Re: pop & popFront combined

2014-09-20 Thread AsmMan via Digitalmars-d-learn
On Saturday, 20 September 2014 at 18:59:03 UTC, Nordlöw wrote: Is there a reason why popFront doesn't automatically return what front does? If so I'm still missing a combined variant of pop and popFront in std.range. Why isn't such a common operation in Phobos already? So far I know isn't c

Re: pop & popFront combined

2014-09-20 Thread Jakob Ovrum via Digitalmars-d-learn
On Saturday, 20 September 2014 at 18:59:03 UTC, Nordlöw wrote: Is there a reason why popFront doesn't automatically return what front does? If so I'm still missing a combined variant of pop and popFront in std.range. Why isn't such a common operation in Phobos already? Sometimes after poppi

pop & popFront combined

2014-09-20 Thread Nordlöw
Is there a reason why popFront doesn't automatically return what front does? If so I'm still missing a combined variant of pop and popFront in std.range. Why isn't such a common operation in Phobos already?

Re: regex problems

2014-09-20 Thread anonymous via Digitalmars-d-learn
On Saturday, 20 September 2014 at 15:28:54 UTC, seany wrote: In haystack, there are two such "ID :" -s. once at the beginning, ID : generateWorld. and then the final, last ID However, this is returning all 5 ID-s as match what am I doing wrong? Prints ID : ID : for me. I'd advise against

Re: is scid still maintained

2014-09-20 Thread K.K. via Digitalmars-d-learn
On Saturday, 20 September 2014 at 13:40:32 UTC, uri wrote: Hi All, I'm wondering if SciD is still maintained because the last commit to this repo is a while ago now... https://github.com/kyllingstad/scid Is there a fork, or some other repo that is more up to date I should look at? Than

regex problems

2014-09-20 Thread seany via Digitalmars-d-learn
consider this: import std.conv, std.algorithm; import core.vararg; import std.stdio, std.regex; void main() { string haystack = "ID : generateWorld; Position : { &

Re: how to create and compile reesources for dmd 64

2014-09-20 Thread K.K. via Digitalmars-d-learn
On Friday, 19 September 2014 at 22:20:59 UTC, Cassio Butrico wrote: Hello everyone, When I create and compile resouces to 32 works perfect, but when I try to compilat of 64 error LNK1136: invalid or corrupt file. I do not know if it has to do with comverter COFF to OMF. can someone give me a li

Re: Are void arrays usable ?

2014-09-20 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Sep 20, 2014 at 10:09:25AM +, badlink via Digitalmars-d-learn wrote: > Hello, > I just discovered this strange behavior: > > struct A { > void[10] x; // OK, compiles fine > } > class B { > void[10] x; // Error: void does not have a default initializer > // ! note, the

is scid still maintained

2014-09-20 Thread uri via Digitalmars-d-learn
Hi All, I'm wondering if SciD is still maintained because the last commit to this repo is a while ago now... https://github.com/kyllingstad/scid Is there a fork, or some other repo that is more up to date I should look at? Thanks, uri

Re: Are void arrays usable ?

2014-09-20 Thread bearophile via Digitalmars-d-learn
Take a look in bugzilla, if it's not already present file it. https://issues.dlang.org/show_bug.cgi?id=13505 Bye, bearophile

Re: Are void arrays usable ?

2014-09-20 Thread bearophile via Digitalmars-d-learn
badlink: Does this mean that void arrays are a thing or it is a bug ? You can compile that with: class Foo { void[10] x = void; } But this code shows a dmd bug (lack of line number): class Foo { void[10] x; } void main() {} Error: void does not have a default initializer Take a

Are void arrays usable ?

2014-09-20 Thread badlink via Digitalmars-d-learn
Hello, I just discovered this strange behavior: struct A { void[10] x; // OK, compiles fine } class B { void[10] x; // Error: void does not have a default initializer // ! note, the message come without any line indication ! } Does this mean that void arrays are a thing or it

Re: [DerelictAlure] Error loading libdumb.so etc...

2014-09-20 Thread Jack via Digitalmars-d-learn
On Saturday, 20 September 2014 at 07:32:17 UTC, Mike Parker wrote: I'm no ALURE expert, but from what I'm reading it appears that libdumb and libfluidsynth are both used by ALURE and are loaded by the library runtime (in the same way that Derelict loads libalure at runtime). So you need to ei

Re: [DerelictAlure] Error loading libdumb.so etc...

2014-09-20 Thread evilrat via Digitalmars-d-learn
On Saturday, 20 September 2014 at 06:47:09 UTC, Jack wrote: I've configured dub to build DerelictAlure for my project which only contains the example code shown in: https://github.com/DerelictOrg/DerelictALURE The build was successful though when I tried to run it, they were spewing out that t

Re: [DerelictAlure] Error loading libdumb.so etc...

2014-09-20 Thread Mike Parker via Digitalmars-d-learn
On 9/20/2014 3:47 PM, Jack wrote: I've configured dub to build DerelictAlure for my project which only contains the example code shown in: https://github.com/DerelictOrg/DerelictALURE The build was successful though when I tried to run it, they were spewing out that they need some sort of .so fi

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

2014-09-20 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2014-09-20 at 06:46 +, "Nordlöw" via Digitalmars-d-learn wrote: > On Thursday, 18 September 2014 at 19:49:00 UTC, Atila Neves wrote: > > I had to roll my own parallel map today, but at least I did get > > a nice 3x speedup. How many cores? Is the problem a data parallel one and hence