Re: Is D suitable for my latest project?

2015-09-09 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote: Hi All, I am considering using D for my latest project and there are a few features I would like and am not entirely sure at this point whether D has them. They are: - dynamic creation of classes/structs at runtime (think I

Re: Is D suitable for my latest project?

2015-09-09 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 20:01:15 UTC, chris stevens wrote: Thanks for the reply Kagamin, just had a quick look at dparse and not sure how I could use it in the way you describe. Any examples of this? As I understand, you wanted to build an AST tree and format it to string?

Re: Is D suitable for my latest project?

2015-09-09 Thread chris stevens via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 08:24:06 UTC, Kagamin wrote: As I understand, you wanted to build an AST tree and format it to string? Thanks again. So I can build an AST and convert it to full D source from that? I think that's what i'm likely going need to do.

Re: Is D suitable for my latest project?

2015-09-09 Thread chris stevens via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 21:51:03 UTC, wobbles wrote: "Previously undefined". As far as I know, this is impossible in D. Thr compiler has to know how much memory to allocate/request and it has to know that at compiletime (else it wouldn't be the compiler!)

Re: Is D suitable for my latest project?

2015-09-09 Thread chris stevens via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 09:14:30 UTC, Atila Neves wrote: So, if your use-case depends on information from the file-system, user interaction, networking, etc. then your only choice is to generate text files with D code and compile it. If, on the other hand, it's all defined by the

Re: Is D suitable for my latest project?

2015-09-09 Thread chris stevens via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 21:51:03 UTC, wobbles wrote: "Previously undefined". As far as I know, this is impossible in D. Thr compiler has to know how much memory to allocate/request and it has to know that at compiletime (else it wouldn't be the compiler!) There was also this:

Re: Is D suitable for my latest project?

2015-09-09 Thread Ali Çehreli via Digitalmars-d-learn
On 09/08/2015 12:30 PM, chris stevens wrote: > create new > (previously undefined) classes in D at runtime that I could then use > with Object.factory to create instances of. SDC is a D compiler as a library but as far as I know, it's not complete yet: https://github.com/SDC-Developers/SDC

Re: Is D suitable for my latest project?

2015-09-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 10:23:55 UTC, chris stevens wrote: http://wiki.dlang.org/Dynamic_typing This is what I saw that made me think that I could. Have had another closer look and I do believe it's possible. These are things I wrote, so let me explain how they work: they do not

Re: Is D suitable for my latest project?

2015-09-08 Thread chris stevens via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static if(otherCondition) return new That; etc). I just had a look at

Re: Is D suitable for my latest project?

2015-09-08 Thread chris stevens via Digitalmars-d-learn
On Monday, 7 September 2015 at 07:57:07 UTC, Kagamin wrote: On Sunday, 6 September 2015 at 15:15:03 UTC, chris stevens wrote: I guess you're right it wouldn't be too difficult to do it all using strings. The code generation I'd done before in c# I'd used some 3rd person library where you build

Re: Is D suitable for my latest project?

2015-09-08 Thread BBasile via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:30:16 UTC, chris stevens wrote: On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static

Re: Is D suitable for my latest project?

2015-09-08 Thread wobbles via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:30:16 UTC, chris stevens wrote: On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static

Re: Is D suitable for my latest project?

2015-09-07 Thread Kagamin via Digitalmars-d-learn
On Sunday, 6 September 2015 at 15:15:03 UTC, chris stevens wrote: I guess you're right it wouldn't be too difficult to do it all using strings. The code generation I'd done before in c# I'd used some 3rd person library where you build up an object model rather than using strings. Maybe with

Re: Is D suitable for my latest project?

2015-09-06 Thread BBasile via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote: - dynamic creation of classes/structs at runtime. You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static if(otherCondition)

Is D suitable for my latest project?

2015-09-06 Thread chris stevens via Digitalmars-d-learn
Hi All, I am considering using D for my latest project and there are a few features I would like and am not entirely sure at this point whether D has them. They are: - dynamic creation of classes/structs at runtime (think I can emulate this with variants/dynamic) - dynamic compilation of

Re: Is D suitable for my latest project?

2015-09-06 Thread chris stevens via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote: - dynamic compilation of code files at runtime I guess I could just invoke the compiler from my code for this? I would also like to be able to load this compiled code into the current process. This probably can be achieved

Re: Is D suitable for my latest project?

2015-09-06 Thread chris stevens via Digitalmars-d-learn
Thanks so much for your reply. On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: if you mean to generate code as string, writing them to a file, of course it will work in D. I guess you're right it wouldn't be too difficult to do it all using strings. The code generation I'd done