Re: cannot build LDC on OSX

2013-08-18 Thread Tyler Jameson Little
On Sunday, 18 August 2013 at 23:31:58 UTC, Timothee Cour wrote: I'm bumping up this issue here https://github.com/ldc-developers/ldc/issues/436 as it's been 16 days with no answer ... am i doing something wrong? it used to work a while ago, IIRC. I don't know if you noticed, but there's an

Re: Is this documented behaviour?

2013-07-27 Thread Tyler Jameson Little
On Wednesday, 24 July 2013 at 15:14:16 UTC, John Colvin wrote: On Tuesday, 23 July 2013 at 16:34:54 UTC, John Colvin wrote: void foo(ref int a) { a = 5; } void main() { int a = 0; int* aptr = a; foo(*aptr); assert(a == 5); a =

Reflection: is type an inner class

2012-10-20 Thread Tyler Jameson Little
Say I have something like this: class A { class B { } B b; } Right now, I have a loop that does something like this (taken from orange project): foreach (i, type; typeof(A.tupleof)) { enum name = A.tupleof[i].stringof[1 + A.stringof.length + 2 ..

Re: Reflection: is type an inner class

2012-10-20 Thread Tyler Jameson Little
I got it working using compiles: A a = new A; foreach (i, type; typeof(A.tupleof)) { enum name = A.tupleof[i].stringof[1 + A.stringof.length + 2 .. $]; static if (__traits(compiles, mixin(A. ~ type.stringof))) { mixin(a. ~ name) = a.new type; } else

Re: Reflection: is type an inner class

2012-10-20 Thread Tyler Jameson Little
I hope this isn't a double post, I'm posting from the web ui. I got this working using __traits(compiles): A a = new A; static if (is(A == class)) { alias TypeTuple!(A, BaseClassesTuple!A) Types; } else { alias TypeTuple!A Types; } foreach (BT; Types) {

Re: Reflection: is type an inner class

2012-10-20 Thread Tyler Jameson Little
On Sunday, 21 October 2012 at 03:40:15 UTC, Andrej Mitrovic wrote: On 10/21/12, Tyler Jameson Little beatgam...@gmail.com wrote: Say I have something like this: class A { class B { } B b; } I can't find a way to figure out if the inner type is static

Re: Code review: JSON unmarshaller

2012-10-17 Thread Tyler Jameson Little
I could make my marshaller/unmarshaller only update objects in place. I think this is more useful and would remove the overlap between orange and the JSON library. We could then write a JSON archiver for orange and include it in std.json as well. The call to unmarshal would look like: bool

Re: Code review: JSON unmarshaller

2012-10-17 Thread Tyler Jameson Little
You have mentioned needing an allMembers that excluded functions in one of your other posts. The following thread was exactly about that. I can never remember the solution, but I found it again: :)

Re: Code review: JSON unmarshaller

2012-10-17 Thread Tyler Jameson Little
Here's the updated code. It's got a marshaller and unmarshaller: https://gist.github.com/3894337 It's about 650 lines. If you have time, I'd be very interested in getting some feedback (or from anyone else who sees this post of course). The main problem I'm having right now is that

Code review: JSON unmarshaller

2012-10-15 Thread Tyler Jameson Little
https://gist.github.com/3894337 This is my first non-trivial D code, and I'd eventually like to get this into Phobos as part of std.json. I haven't written the marshaller yet, but that shouldn't be too hard. I wanted to get some feedback on whether this code is up to the quality standards

Re: Code review: JSON unmarshaller

2012-10-15 Thread Tyler Jameson Little
I'm not sure what your goal with this marshaller is but I would say it's a lot harder than you think if you want to have a complete serialization library. A couple of things making it harder to create a fully working serialization library: I'm basically trying to reproduce other JSON

Can I do an or in a version block?

2012-03-07 Thread Tyler Jameson Little
I would like to do something like this: version (linux || BSD) { // do something... } else { version (Windows) { // do something else } else { // do something else assert(false, Unsupported operating system); } } The only way I've been able to do this, is

Re: Can I do an or in a version block?

2012-03-07 Thread Tyler Jameson Little
Now, you could do version(x) version = xOrY else version(y) version = xOrY version(xOrY) {} Huh, clever! I like it!! I hope I don't have to do that very often, though... Of course, if the issue is linux || FreeBSD, you might want to just consider using Posix. Unless you're doing

Re: Can I do an or in a version block?

2012-03-07 Thread Tyler Jameson Little
Now, you could do version(x) version = xOrY else version(y) version = xOrY version(xOrY) {} Huh, clever! I like it!! I hope I don't have to do that very often, though... Of course, if the issue is linux || FreeBSD, you might want to just consider using Posix. Unless you're doing

Re: Raw socket TCP/IP

2012-03-07 Thread Tyler Jameson Little
Just curious, but what exactly do you need a raw IP socket for?

Is there a wrapper for libuv?

2012-03-06 Thread Tyler Jameson Little
I hope this is the right place to ask this. libuv is the evented IO library that nodejs uses internally. It is basically glue for a bunch of other libraries (libev, c-ares, libeio and others). https://github.com/joyent/libuv Is there already working on a wrapper? I would very much like to

Re: Is there a wrapper for libuv?

2012-03-06 Thread Tyler Jameson Little
You shouldn't have to do anything with them, just write bindings for the api, with all the correct types. -- James Miller Thanks! I guess I got a little over-zealous in porting stuff over. I just need to create extern (C) bindings for the functions that will be used, right?

How do I force something onto the heap? (need for libev)

2012-03-05 Thread Tyler Jameson Little
I've been playing with libev in D lately, and I've run into a problem. I've been able to hack around it, but it'd like to find a better, more general solution. Here's a link to the code: https://github.com/beatgammit/fun-with-d/blob/master/libev/tcp_server.d The code is a basic TCP server that

Re: How do I force something onto the heap? (need for libev)

2012-03-05 Thread Tyler Jameson Little
On Tuesday, 6 March 2012 at 04:54:44 UTC, Mike Parker wrote: On 3/6/2012 1:34 PM, Tyler Jameson Little wrote: I've been playing with libev in D lately, and I've run into a problem. I've been able to hack around it, but it'd like to find a better, more general solution. Here's a link

Re: How do I force something onto the heap? (need for libev)

2012-03-05 Thread Tyler Jameson Little
Oh, thanks! I missed your reply. That sounds reasonable, and a lot better than my super hacky Socket[]. Thanks!

Re: How do I force something onto the heap? (need for libev)

2012-03-05 Thread Tyler Jameson Little
On Tuesday, 6 March 2012 at 05:17:20 UTC, Mike Parker wrote: On 3/6/2012 2:10 PM, Tyler Jameson Little wrote: Oh, thanks! I missed your reply. That sounds reasonable, and a lot better than my super hacky Socket[]. Thanks! I've never used libev and am only vaguely familiar

Re: Re: class templates and static if

2012-02-27 Thread Tyler Jameson Little
Parser!(Type.request) h = new Parser!(Type.request)(Hello world) Wow, I was so close! I had tried this: Parser!Type.request h = new Parser!Type.request(Hello world); but that didn't work. I didn't think about enclosing it in parens! I didn't want to do subclassing, because my parser is a

class templates and static if

2012-02-26 Thread Tyler Jameson Little
So, here's my code, as it stands currently: import std.stdio; static enum Type { request, response }; class Parser(Type t) { static if (t == Type.request) { string name = request; } else { string name = response; } string message; this(string message) { this.message = message; } } void