Re: dmdscript osx.mak
On 18.06.2011 10:35, Joshua Niehus wrote: Hello, I apologize if this is the wrong forum to post this question, but I couldn't find a corresponding learn mailing list for DMDScript. I wanted to play around with DMDScript but cant seem to get started. I downloaded the source and attempted to make it via: $ make -f osx.mak But I get the following error: textgen.d(132): Error: cannot implicitly convert expression ~ some string ~ of type string to char[] Am I doing the right thing? Or how do I go about getting building 'ds' so I can run simpleton scripts? Josh It's pretty much like Robert says: original source for DMDscript is for D1 and wasn't update for quite some time. Still the D2 port should work with no problems. And even though I did it in the first place, the only benefit of it right now is that it's written in D and thus could be integrated with D projects slightly better. Still if you are up for some hacking give it a try. As for speed, yeah, it's something like around 20-200x slower at various workloads (e.g. numerics in JavaScript and such), so wouldn't recommend if you have performance in mind. -- Dmitry Olshansky
Re: dmdscript osx.mak
On 18/06/2011 21:50, Robert Clipsham wrote: On 18/06/2011 07:35, Joshua Niehus wrote: Hello, I apologize if this is the wrong forum to post this question, but I couldn't find a corresponding learn mailing list for DMDScript. I wanted to play around with DMDScript but cant seem to get started. I downloaded the source and attempted to make it via: $ make -f osx.mak But I get the following error: textgen.d(132): Error: cannot implicitly convert expression ~ some string ~ of type string to char[] Am I doing the right thing? Or how do I go about getting building 'ds' so I can run simpleton scripts? Josh dmdscript is designed for D1, you're using D2. Someone has updated dmdscript for D2, there's an announcement on digitalmars.D.announce about it somewhere. Using that version will fix your issues. http://dsource.org/projects/dmdscript-2/wiki <= there you go. I should probably note that if you plan on doing anything serious, you'd be better off writing a D wrapper for V8 or one of the other modern javascript engines. -- Robert http://octarineparrot.com/
Re: dmdscript osx.mak
On 18/06/2011 07:35, Joshua Niehus wrote: Hello, I apologize if this is the wrong forum to post this question, but I couldn't find a corresponding learn mailing list for DMDScript. I wanted to play around with DMDScript but cant seem to get started. I downloaded the source and attempted to make it via: $ make -f osx.mak But I get the following error: textgen.d(132): Error: cannot implicitly convert expression ~ some string ~ of type string to char[] Am I doing the right thing? Or how do I go about getting building 'ds' so I can run simpleton scripts? Josh dmdscript is designed for D1, you're using D2. Someone has updated dmdscript for D2, there's an announcement on digitalmars.D.announce about it somewhere. Using that version will fix your issues. -- Robert http://octarineparrot.com/
Re: dummy question : runtime type testing...
on a related not. in the (templated) function taking a variant, I use the coerce() method which does some conversion (byte to int, for example) the suggested code (while excellent, much thanks again!) is very stringent, doesn't allow for such implicit conversion i.e. with bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { return ( ti1 is ti2 ); } isTypeOf(typeid(byte), typeid(int)) will return false. is there (I might be pushing it here, I know :P) a way to make it return true in such case?? "Mike Wey" wrote in message news:ithv61$2j5t$1...@digitalmars.com... On 06/18/2011 05:28 AM, Lloyd Dupont wrote: ho... easy hey! but how about the other 2 test I'd like be able to run? bool isTypeOf(T)(TypeInfo ti) { "return T is ti" } bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { "return ti1 is ti2" } bool isTypeOf(T)(TypeInfo ti) { return ( typeid(T) is ti ); } bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { return ( ti1 is ti2 ); } -- Mike Wey
Re: dummy question : runtime type testing...
That simple hey?!? Awesome! You are a week-end saver! :) "Mike Wey" wrote in message news:ithv61$2j5t$1...@digitalmars.com... bool isTypeOf(T)(TypeInfo ti) { return ( typeid(T) is ti ); } bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { return ( ti1 is ti2 ); } -- Mike Wey
Re: dummy question : runtime type testing...
On 06/18/2011 05:28 AM, Lloyd Dupont wrote: ho... easy hey! but how about the other 2 test I'd like be able to run? bool isTypeOf(T)(TypeInfo ti) { "return T is ti" } bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { "return ti1 is ti2" } bool isTypeOf(T)(TypeInfo ti) { return ( typeid(T) is ti ); } bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { return ( ti1 is ti2 ); } -- Mike Wey
TypeInfo problem
Let's say I have 2 value only accessible through function pointers taking a variant parameter. (they will throw on incorrect value, but I'd rather avoid that). I also know the TypeInfo of both variables. How could I know that a given TypeInfo is a valid value for another TypeInfo. In other words I'd like to write a method like bool isAcceptable(TypeInfo srcValueType, TypeInfo dstType) { /* ?? */ }