Re: Installing 32 bit libcurl.so.4 on Ubuntu

2014-04-08 Thread Jacob Carlborg
On 09/04/14 05:31, Walter Bright wrote: Anyone know how? sudo apt-get install curl doesn't do it. Are you referring to how to install it on a 64bit machine? In that case you need "gcc-multilib" and "ia32-libs". I'm not 100% sure it's included, but I think so. If you're on a 32bit mac

build anchovy,find a bug when build utils.lib

2014-04-08 Thread FrankLike
Hi,MrSmith, Compilation failed: import\anchovy\utils\rect.d(110): Error: 'dlib.math.utils.clampValue!uint.clamp' is not nothrow import\anchovy\utils\rect.d(114): Error: 'dlib.math.utils.clampValue!uint.clamp' is not nothrow import\anchovy\utils\rect.d(119): Error: 'dlib.math.utils.clampValu

Installing 32 bit libcurl.so.4 on Ubuntu

2014-04-08 Thread Walter Bright
Anyone know how? sudo apt-get install curl doesn't do it.

Re: can I generate an enum from a typelist?

2014-04-08 Thread bearophile
Vlad Levenfeld: alias Layer = Algebraic !(Solid, Gradient, Text, Sprite, Plane); I suggest no space before the bang when you instantiate templates. Bye, bearophile

Re: can I generate an enum from a typelist?

2014-04-08 Thread Vlad Levenfeld
That's exactly what I was looking for. I pulled the Solid,...,etc definitions out of Layer and replaced the entire Layer definition with this: alias Layer = Algebraic !(Solid, Gradient, Text, Sprite, Plane); and after grepping in the get!(T) method, everything works perfectly. This is a reall

Re: Continued: DMD Source Hot Spot for Expression Type Deduction

2014-04-08 Thread Nordlöw
I just realized that maybe the best way is to recurse down the AST until I find node(s) whose token range cover my query point right?

Continued: DMD Source Hot Spot for Expression Type Deduction

2014-04-08 Thread Nordlöw
So far I figured that what I typically want to do is printf("Type: %s", e->type->toChars()); whenever I find a type-deduced expression e that fulfils (e->loc->linnum == QUERY_LINE && e->loc->charnum <= QUERY_COLUMN && QUERY_COLUMN < (e->loc->charnum + e->length_of_expression_

Re: math evaluation on runtime

2014-04-08 Thread Szabo Bogdan
Thanks! I was looking for some kind of mixins but at the run time... But this library look interesting. I think i will use something like this. Bogdan On Tuesday, 8 April 2014 at 20:31:55 UTC, Rene Zwanenburg wrote: On Tuesday, 8 April 2014 at 20:18:43 UTC, Szabo Bogdan wrote: Hi, There

DMD Source Hot Spot for Expression Type Deduction

2014-04-08 Thread Nordlöw
I'm looking for hot spots in the DMD source where deduction of types of expressions are performed. I want to use this to extract information about the type of an expression before/after point. Is this logic spread all over .*Exp::semantic .*Exp::semantic2 .*Exp::semantic3 or is there a hot

Re: copying memory in phobos

2014-04-08 Thread Mike Wey
On 04/08/2014 02:35 PM, Mike wrote: On Tuesday, 8 April 2014 at 11:56:43 UTC, ketmar wrote: I understand that. But why is dest[] = src[] not good enough for run-time? 'cause some compilers (gcc, for example) has memcpy() as 'intrinsic' and generates better inline code for it sometimes. it's ju

Re: running my program with shared libraries

2014-04-08 Thread JR
On Sunday, 6 April 2014 at 02:49:15 UTC, Adam D. Ruppe wrote: LD_LIBRARY_PATH tells it where to find the shared library files. Without it, the system only searches the global directories like /usr/lib. To list said directories; ldconfig -v 2>/dev/null | grep '^/' You can add your own pat

Re: math evaluation on runtime

2014-04-08 Thread H. S. Teoh
On Tue, Apr 08, 2014 at 08:18:41PM +, Szabo Bogdan wrote: > Hi, > > There is any way to evaluate simple math strings like this one: "(1 + > 2) * 3" and pass the result? [...] If you want this at runtime, you'd have to write your own expression parser. At compile-time, you can use a mixin. T

Re: math evaluation on runtime

2014-04-08 Thread Rene Zwanenburg
On Tuesday, 8 April 2014 at 20:18:43 UTC, Szabo Bogdan wrote: Hi, There is any way to evaluate simple math strings like this one: "(1 + 2) * 3" and pass the result? Thanks, Bogdan Not built in, but Pegged has an example which does exactly that: https://github.com/PhilippeSigaud/Pegged/blo

math evaluation on runtime

2014-04-08 Thread Szabo Bogdan
Hi, There is any way to evaluate simple math strings like this one: "(1 + 2) * 3" and pass the result? Thanks, Bogdan

Re: std.variant, elaborate copying and GC

2014-04-08 Thread Yuriy
Ah, now that's clear. Ok, what about the other question? E.g. I'm trying to implement a bridge to C lib with reference counting. My "references" are structs. Ctor retains, dtor releases, assign does both. Looks like my struct can not be used with variants. Should i submit a pull to fix that?

Re: Using std.net.curl

2014-04-08 Thread Volodymyr Kvyt
On Wednesday, 4 July 2012 at 17:19:02 UTC, Brad Anderson wrote: I just ended up specifying the link command manually (see my answer on the Stack Overflow). It's ugly but it works. Leandro discusses a solution here: It hasn't been impl

Re: Manually-allocated memory and maximum array capacity

2014-04-08 Thread Joseph Rushton Wakeling
On 08/04/14 16:58, Artur Skawina wrote: Just be careful; I used the name 'capacity' because it fit into your example, but 'capacity' shouldn't be overloaded like that - it works very differently from the magic built-in property. Yes, I was thinking that I'd better use a different name. (Actual

Anyone have sucess converting MSVC 2010 COFF libs to OMF

2014-04-08 Thread Byron
I have several libs compiled in vs2010 that I need to convert to omf. With the same setup I have this linked in win64, just want to get win32. I have tried coff2omf but it fails with: > coff2omf leveldb.lib COFF2OMF: Converting 'd:\projects\leveldb\bin\release\tmp\leveldb.lib' COFF2OMF: Ignoring

Re: std.variant, elaborate copying and GC

2014-04-08 Thread Rene Zwanenburg
On Tuesday, 8 April 2014 at 16:03:01 UTC, Yuriy wrote: Also, i can't completely understand how garbage collection works. E.g. setting an instance of a class to std.variant will copy its reference to variant's internal storage, which is void[]. Will GC loose track of such reference? Thanx. It

Re: Using std.stdio.File in a class

2014-04-08 Thread Steven Schveighoffer
On Tue, 08 Apr 2014 11:54:45 -0400, Spacen Jasset wrote: On Tuesday, 8 April 2014 at 15:18:20 UTC, Steven Schveighoffer wrote: Just a word of caution, I don't think the RAII semantics of File work properly in multithreaded code when the File is destroyed by the GC. What do you mean by don

Re: std.variant, elaborate copying and GC

2014-04-08 Thread Yuriy
Sorry for all the typos. It's been a long day =).

std.variant, elaborate copying and GC

2014-04-08 Thread Yuriy
Hello, i've been playing around with std.variant and noticed, that it does not support elaborate copying, when a struct uses one. So the question is whether it is intended or not. If yes, std.variant should probably prohibit usage of such structs. If no, then it we will need to add a destructor

Re: Using std.stdio.File in a class

2014-04-08 Thread Adam D. Ruppe
On Tuesday, 8 April 2014 at 15:52:23 UTC, Spacen Jasset wrote: scope Stream file = new File(filename); That's a std.stream.File which is a class (implementing the Stream interface) which is a different animal from std.stdio.File, which is a struct.

Re: Using std.stdio.File in a class

2014-04-08 Thread Spacen Jasset
On Tuesday, 8 April 2014 at 15:18:20 UTC, Steven Schveighoffer wrote: On Tue, 08 Apr 2014 10:52:01 -0400, Spacen Jasset wrote: I am trying to use file in a class. It doesn't seem to work. File is a struct. Are you not supposed to new structs anymore? The examples seem to use auto, but that i

Re: Using std.stdio.File in a class

2014-04-08 Thread Spacen Jasset
On Tuesday, 8 April 2014 at 15:15:37 UTC, Rene Zwanenburg wrote: On Tuesday, 8 April 2014 at 15:08:17 UTC, Spacen Jasset wrote: On Tuesday, 8 April 2014 at 14:53:56 UTC, Adam D. Ruppe wrote: On Tuesday, 8 April 2014 at 14:52:02 UTC, Spacen Jasset wrote: Are you not supposed to new structs anym

Re: Anchovy is good,Find a bug: can't get the gui.lib

2014-04-08 Thread MrSmith
On Tuesday, 8 April 2014 at 14:31:42 UTC, FrankLike wrote: hello,MrSmith, I build the anchovy's guidemo, but can't get the gui.lib, the err is :timemanager.d(153) instantiated from here:sort!(a.) std\range.d(2188) can't be declared be a funtion you can test the build ,you will see

Re: Using std.stdio.File in a class

2014-04-08 Thread monarch_dodra
On Tuesday, 8 April 2014 at 15:18:20 UTC, Steven Schveighoffer wrote: Just a word of caution, I don't think the RAII semantics of File work properly in multithreaded code when the File is destroyed by the GC. -Steve RAII doesn't work correctly with GC, period.

Re: Using std.stdio.File in a class

2014-04-08 Thread Rene Zwanenburg
On Tuesday, 8 April 2014 at 15:08:17 UTC, Spacen Jasset wrote: On Tuesday, 8 April 2014 at 14:53:56 UTC, Adam D. Ruppe wrote: On Tuesday, 8 April 2014 at 14:52:02 UTC, Spacen Jasset wrote: Are you not supposed to new structs anymore? Only if they're pointers. new File returns a File*, not a F

Re: Using std.stdio.File in a class

2014-04-08 Thread Steven Schveighoffer
On Tue, 08 Apr 2014 10:52:01 -0400, Spacen Jasset wrote: I am trying to use file in a class. It doesn't seem to work. File is a struct. Are you not supposed to new structs anymore? The examples seem to use auto, but that isn't going to work in this situation. Is File a struct to take adv

Re: Understanding switch + foreach

2014-04-08 Thread Steven Schveighoffer
On Mon, 07 Apr 2014 18:30:30 -0400, Matej Nanut wrote: Hello, I don't understand why so many break statements are needed in this construct: immutable key = 3; switch (key) { foreach (c; TypeTuple!(1, 2, 3, 4, 5)) { case c: "Found %s!".writefln(c);

Re: Using std.stdio.File in a class

2014-04-08 Thread Spacen Jasset
On Tuesday, 8 April 2014 at 14:53:56 UTC, Adam D. Ruppe wrote: On Tuesday, 8 April 2014 at 14:52:02 UTC, Spacen Jasset wrote: Are you not supposed to new structs anymore? Only if they're pointers. new File returns a File*, not a File. But you shouldn't new a File because then the file won't b

Re: copying memory in phobos

2014-04-08 Thread Artur Skawina
On 04/08/14 14:35, Mike wrote: > On Tuesday, 8 April 2014 at 11:56:43 UTC, ketmar wrote: >>> I understand that. But why is dest[] = src[] not good enough for run-time? >> 'cause some compilers (gcc, for example) has memcpy() as 'intrinsic' and >> generates better inline code for it sometimes. it'

Re: Manually-allocated memory and maximum array capacity

2014-04-08 Thread Artur Skawina
On 04/07/14 22:58, Joseph Rushton Wakeling wrote: > On 05/04/14 02:18, Artur Skawina wrote: >> Not portably, as it will be libc and/or allocator specific. > > I think that's fine. I would be using it in circumstances where it's nice to > have if I can get it, not a problem if I can't. As long a

Using std.stdio.File in a class

2014-04-08 Thread Spacen Jasset
I am trying to use file in a class. It doesn't seem to work. File is a struct. Are you not supposed to new structs anymore? The examples seem to use auto, but that isn't going to work in this situation. Is File a struct to take advantage of Raii? import std.stdio; class X { this() {

Re: Using std.stdio.File in a class

2014-04-08 Thread Adam D. Ruppe
On Tuesday, 8 April 2014 at 14:52:02 UTC, Spacen Jasset wrote: Are you not supposed to new structs anymore? Only if they're pointers. new File returns a File*, not a File. But you shouldn't new a File because then the file won't be automatically closed when it goes out of scope (RAII indeed).

Re: Modify Object Pointer during Initialzation

2014-04-08 Thread Jeroen Bollen
On Tuesday, 8 April 2014 at 14:26:46 UTC, Adam D. Ruppe wrote: On Tuesday, 8 April 2014 at 14:23:02 UTC, Jeroen Bollen wrote: Is there a documentation page about the 'uniform function call syntax'? http://dlang.org/function.html#pseudo-member Oh beat me to it.

Anchovy is good,Find a bug: can't get the gui.lib

2014-04-08 Thread FrankLike
hello,MrSmith, I build the anchovy's guidemo, but can't get the gui.lib, the err is :timemanager.d(153) instantiated from here:sort!(a.) std\range.d(2188) can't be declared be a funtion you can test the build ,you will see it. anchovy: https://github.com/MrSmith33/anchovy/ http

Re: Modify Object Pointer during Initialzation

2014-04-08 Thread Adam D. Ruppe
On Tuesday, 8 April 2014 at 14:23:02 UTC, Jeroen Bollen wrote: Is there a documentation page about the 'uniform function call syntax'? http://dlang.org/function.html#pseudo-member

Re: Modify Object Pointer during Initialzation

2014-04-08 Thread Jeroen Bollen
On Tuesday, 8 April 2014 at 14:23:02 UTC, Jeroen Bollen wrote: Is there a documentation page about the 'uniform function call syntax'? Never mind, I think I understand all there is to it.

Re: Modify Object Pointer during Initialzation

2014-04-08 Thread Jeroen Bollen
On Tuesday, 8 April 2014 at 14:13:10 UTC, Adam D. Ruppe wrote: On Tuesday, 8 April 2014 at 14:04:01 UTC, Jeroen Bollen wrote: Basically, why is this its own variable? Why doesn't D simply use the variable it was called with? A class reference is basically a pointer, passing it by reference to

Re: Modify Object Pointer during Initialzation

2014-04-08 Thread Adam D. Ruppe
On Tuesday, 8 April 2014 at 14:04:01 UTC, Jeroen Bollen wrote: Basically, why is this its own variable? Why doesn't D simply use the variable it was called with? A class reference is basically a pointer, passing it by reference to each method would be a double pointer and wasted effort most t

Re: can I generate an enum from a typelist?

2014-04-08 Thread Rene Zwanenburg
On Tuesday, 8 April 2014 at 08:31:16 UTC, Vlad Levenfeld wrote: Ok, starting to feel a bit sheepish at this point, that constructor was unnecessarily verbose: this (T) (T layer) { import std.string: toLower; mixin ("this."~toLower (T.stringof)~"= layer;"); this.type = ca

Modify Object Pointer during Initialzation

2014-04-08 Thread Jeroen Bollen
This topic is somewhat related to this question I asked yesterday on StackOverflow: http://stackoverflow.com/q/22921395/2558778 Basically, why is this its own variable? Why doesn't D simply use the variable it was called with? https://gist.github.com/Binero/10128826 I don't see why this need

Re: can I generate an enum from a typelist?

2014-04-08 Thread Frustrated
On Tuesday, 8 April 2014 at 08:31:16 UTC, Vlad Levenfeld wrote: Ok, starting to feel a bit sheepish at this point, that constructor was unnecessarily verbose: this (T) (T layer) { import std.string: toLower; mixin ("this."~toLower (T.stringof)~"= layer;"); this.type = ca

Re: copying memory in phobos

2014-04-08 Thread Mike
On Tuesday, 8 April 2014 at 11:56:43 UTC, ketmar wrote: I understand that. But why is dest[] = src[] not good enough for run-time? 'cause some compilers (gcc, for example) has memcpy() as 'intrinsic' and generates better inline code for it sometimes. it's just a small hint for compiler backend

Re: copying memory in phobos

2014-04-08 Thread ketmar
I understand that. But why is dest[] = src[] not good enough for run-time? 'cause some compilers (gcc, for example) has memcpy() as 'intrinsic' and generates better inline code for it sometimes. it's just a small hint for compiler backend, and faster code is good, isn't it? ;-)

Re: Understanding switch + foreach

2014-04-08 Thread Matej Nanut
On 8 April 2014 02:30, bearophile wrote: > On default compile the D code with warnings active. I'm not sure what you mean? I have the -w and -wi flags always enabled and I don't get any warnings. I'm using DMD 2.065.

Re: copying memory in phobos

2014-04-08 Thread Mike
On Tuesday, 8 April 2014 at 10:04:01 UTC, bearophile wrote: Mike: Why two different implementations for copying memory (i.e. memcpy vs. dest[] = src[])? Why not use dest[] = src[] exclusively. Because currently you can't use memcpy at compile-time. Bye, bearophile I understand that. But

copying memory in phobos

2014-04-08 Thread Mike
I ran accross the following code in phobos std.array: void trustedMemcopy(T[] dest, T[] src) @trusted { assert(src.length == dest.length); if (!__ctfe) memcpy(dest.ptr, src.ptr, src.length * T.sizeof); else { dest[] = src[]; } } Why two different implementatio

Re: copying memory in phobos

2014-04-08 Thread bearophile
Mike: Why two different implementations for copying memory (i.e. memcpy vs. dest[] = src[])? Why not use dest[] = src[] exclusively. Because currently you can't use memcpy at compile-time. Bye, bearophile

Re: can I generate an enum from a typelist?

2014-04-08 Thread Vlad Levenfeld
Ok, starting to feel a bit sheepish at this point, that constructor was unnecessarily verbose: this (T) (T layer) { import std.string: toLower; mixin ("this."~toLower (T.stringof)~"= layer;"); this.type = cast (const) typeid (T); } ...is what I have settled on. Sorry for

Re: can I generate an enum from a typelist?

2014-04-08 Thread Vlad Levenfeld
On Tuesday, 8 April 2014 at 07:39:29 UTC, Vlad Levenfeld wrote: I'm a beginner to D and I have written this awful code: struct Layer { // defs alias Types = TypeTuple !(Solid, Gradient, Text, Sprite, Plane); enum Type { solid = static

can I generate an enum from a typelist?

2014-04-08 Thread Vlad Levenfeld
I'm a beginner to D and I have written this awful code: struct Layer { // defs alias Types = TypeTuple !(Solid, Gradient, Text, Sprite, Plane); enum Type { solid = staticIndexOf !(Solid, Types), gradient= s