Re: Compiler silently ignores some method overloads
On Monday, 9 May 2016 at 11:22:37 UTC, pineapple wrote: On Monday, 9 May 2016 at 00:27:17 UTC, Peter Häggman wrote: Can you show your GLColor struct ? Maybe it contains an alias this or something else that mess the overload resolution. My GLColor struct: http://pastebin.com/mUcA6G85 No problem here (tested with everything in a single module). I can't help more. Front end version ?
Re: C#7 features
On Friday, 6 May 2016 at 14:33:22 UTC, Andrei Alexandrescu wrote: Most of them are also present in D, yay. https://www.reddit.com/r/programming/comments/4i3h77/some_new_c7_features/ Added a comment: https://www.reddit.com/r/programming/comments/4i3h77/some_new_c7_features/d2v5lu6 Andrei Their tuples seem to be a complete DIY: https://msdn.microsoft.com/en-us/library/system.tuple(v=vs.110).aspx I wouldn't be surpised to see in the implementation an array of variant or something like that, explaining why it's limited to octuples [1]. Sharp tuples look weak compared to D tuple-ish things: Tuple, TList, AliasSeq, variadics, ... [1] Also I think that the param-"variadicity" is simply emulated via a set of overloaded constructor, explaining why they stop at 8.
Re: Compiler silently ignores some method overloads
On Sunday, 8 May 2016 at 13:28:47 UTC, pineapple wrote: [...] I get a compiler error like so: E:\Dropbox\Projects\d\mach\sdl\surface.d(434): Error: none of the overloads of 'opIndexAssign' are callable using argument types (GLColor!float, int, int), candidates are: E:\Dropbox\Projects\d\mach\sdl\surface.d(406): mach.sdl.surface.Surface.opIndexAssign(const(uint) value, const(int) x, const(int) y) Meaning the overloads using GLColor are apparently silently ignored? No they are not ignored, otherwise the following would not compile: struct GLColor(T){T t0,t1,t2;} struct Thing { void opIndexAssign(T)(in GLColor!T color, in int x, in int y){} void opIndexAssign(T1, T2)(in GLColor!T1 color, in Vector2!T2 vector){} void opIndexAssign(in uint value, in int x, in int y){} } void main(string[] args) { Thing thing; thing[2,2] = GLColor!float(1, 1, 1); } Can you show your GLColor struct ? Maybe it contains an alias this or something else that mess the overload resolution.
Re: Compiler benchmarks for an alternative to std.uni.asLowerCase.
On Sunday, 8 May 2016 at 23:38:31 UTC, Jon D wrote: I did a performance study on speeding up case conversion in std.uni.asLowerCase. Specifics for asLowerCase have been added to issue https://issues.dlang.org/show_bug.cgi?id=11229. Publishing here as some of the more general observations may be of wider interest. [...] Nice, it seems that you would have enough material to advocate a pull request in phobos then ;)
Re: How to convert this code: (is(ToString(t))
On Sunday, 8 May 2016 at 18:55:58 UTC, Pablo wrote: This is part of the old dparse.d file: private import std.string : ToString = toString ; char[] string() { static if(str) { static if(is(T == char[])) return t; else static if(is(ToString(t))) return ToString(t); else return "<<"~T.stringof~">>"; } else return "<<"~T.stringof~">>"; } I have a problem with this part: (is(ToString(t)) : dparse.d(215): Error: function declaration without return type. (Note that constructors are always named 'this') How to fix this code? Regards Pawel You must replace with "static if (is(typeof(to!string(t;"
Re: Adventures in D Programming
On Sunday, 8 May 2016 at 17:19:05 UTC, qznc wrote: On Sunday, 8 May 2016 at 06:05:36 UTC, Iain Buclaw wrote: http://blog.tenstral.net/2016/05/adventures-in-d-programming.html Thanks, I missed that post until now. "the documentation not matching the actual code is a bad experience for someone new to the language" I would interpret that as a sign that we want multiple versions of documentation available on the website. For example, Python does that. You've quoted the wrong part of the paragraph. The real problem he encountered was not the doc, it was the phobos bugs in the older version shipped with GDC/LDC: "For GDC, which I used to compile my code due to LDC having bugs at that time, this means that it is shipping with a very outdated copy of Phobos" The the doc thing is "just" a symptom. Older offline doc is always available in the release archive, it's easy to understand that so it's not the actual problem.