Re: Implicit casting of int enum members to int
On Monday, 5 June 2017 at 01:23:22 UTC, Mike B Johnson wrote: On Monday, 3 October 2016 at 09:21:37 UTC, Jonathan M Davis wrote: Is this bug ever going to be fixed? I've filed this issue under https://issues.dlang.org/show_bug.cgi?id=16586 a while ago, seems to have not been picked up yet.
Imports incorrectly part of "allMembers" trait output?
When compiling the following code with DMD 2.072.2: class LeClass { import std.stdio; } void main() { foreach (memberName; __traits(allMembers, LeClass)) { pragma(msg, memberName); } } The following output is shown in the console: std toString toHash opCmp opEquals Monitor factory Note how "std" is part of the output of allMembers. Is this a bug or is this intended behavior? I don't think imports are necessarily members of a class. It also happens for static imports.
[Vibe.d] Handling event loop manually
In my application I have already have an event loop running taking care of all sorts of things. Now I want to use Vibe.d to run an asynchronous websocket API to provide some debugging information. Normally Vibe.d's main takes care of handling the event loop. I want to run vibe's event loop manually. So far I tried to get the EventDriver and calling processEvents() but this does not seem to service any connections at all. runEventLoop() and runEventLoopOnce() do process the connections but of course block the whole event loop. Does anyone know how I can do this?
Implicit casting of int enum members to int
Consider the following code: enum StringTypeEnumOne : string { bla = "bla" } enum StringTypeEnumTwo : string { bleh = "bleh" } enum IntTypeEnumOne : int { bla = 1 } enum IntTypeEnumTwo : int { bleh = 2 } public void main() { string[] strings = [StringTypeEnumOne.bla, StringTypeEnumTwo.bleh]; int[] ints = [IntTypeEnumOne.bla, IntTypeEnumTwo.bleh]; } When compiled the following compilation error is thrown: src\app.d(19,16): Error: cannot implicitly convert expression (cast(IntTypeEnumOne)1) of type IntTypeEnumOne to IntTypeEnumTwo The string members are implicitly cast just fine, however I also expected the members of the int enum to be cast implicitly because I explicitly defined the base type of the enum. Is this a bug in D? Or is using an int as base type the same as having no base type at all?