Re: Voldemort Type Construction Error
On Friday, 15 January 2016 at 20:04:47 UTC, Nordlöw wrote: On Friday, 15 January 2016 at 16:51:24 UTC, Anon wrote: On Friday, 15 January 2016 at 14:04:50 UTC, Nordlöw wrote: What have I missed? In line 126, `static struct Result()` is a template. Either drop the parens there, or change the call on line 187 to `Result!()(haystack, needles)`. Ahh, annoying mistake. Why is this allowed? /Per At least for functions, making them templates provides some benefits like inferring attributes. Not sure if it behaves the same way on structs by making all functions within it templates.
Re: Adam D. Ruppe's Minigui using example
On Saturday, 16 January 2016 at 01:27:32 UTC, Andre Polykanine wrote: Does anyone have an actual example of, say, a simple form with a set of radio buttons or check boxes to start with? Thanks in advance! Sort of. I still haven't used it in a real world program so it isn't complete but here's one of my test programs: --- import arsd.minigui; void main() { auto window = new MainWindow(); auto exitAction = new Action("E&xit"); exitAction.triggered ~= { window.close(); }; window.statusTip = "D ROX!"; auto button = new Checkbox("Uses D!", window); button.isChecked = true; auto hlayout = new HorizontalLayout(window); auto gb = new Fieldset("Type", hlayout); auto gb2 = new Fieldset("cool", hlayout); auto boxlol1 = new Radiobox("Test", gb); auto boxlol2 = new Radiobox("Test2", gb2); auto boxlol3 = new Radiobox("Test", gb); auto boxlol4 = new Radiobox("Test2", gb2); auto group = new MutuallyExclusiveGroup(); group.addMember(new Radiobox("Heavyweight", gb)); auto btn = group.addMember(new Radiobox("Small library", gb)); btn.isChecked = true; btn.statusTip = "205 KB exe on Windows"; //auto spinner = new Spinner(window); ComboboxBase cb = new DropDownSelection(window); cb.addOption("test"); cb.addOption("cool"); cb.setSelection(1); //cb.addEventListener("changed", (Event ev) { //auto bm = new MessageBox("changed " ~ cb.options[cb.selection]); //}); // FIXME: adding this to gb2 instead of window causes wtf stuff cb = new ComboBox(window); cb.addOption("test"); cb.addOption("cool"); cb.setSelection(1); cb = new FreeEntrySelection(window); cb.addOption("test"); cb.addOption("cool"); cb.setSelection(1); auto lineEdit = new LineEdit(window); auto menu = new MenuBar(); auto fileMenu = new Menu("&File"); auto exitButton = fileMenu.addItem(new MenuItem(exitAction)); menu.addItem(fileMenu); window.loop(); } --- On Windows, it uses the native controls, so it should work reasonably well, though on Linux it does its own thing and is far from complete. BTW simplewindow doesn't seem to compile on newest dmd because of the new core.sys.windows.windows so I'll have to update that if you're on the newest release...
Adam D. Ruppe's Minigui using example
Hi everyone, I would like to use Minigui (https://github.com/adamdruppe/arsd/blob/master/minigui.d) and test it for accessibility. Does anyone have an actual example of, say, a simple form with a set of radio buttons or check boxes to start with? Thanks in advance!
Fuck the brits
On Friday, 15 January 2016 at 22:16:09 UTC, Basile B. wrote: On Tuesday, 5 January 2016 at 23:52:05 UTC, Basile B. wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s https://www.youtube.com/watch?v=YgSPaXgAdzE I'm a loser baby, so why don't you leave me ? You luv losers ? And you don't leave them ? Nurse syndrom. to the MI6: It's a english daddy boy who tought me what is a papirosn https://en.wikipedia.org/wiki/Belomorkanal TIP to englishmen: you should learn how to behave in France. Like the whole world can see today, you have took an anwesome decision in 1948. Well managed. very clever I'd say...
Re: Variable below zero but if statement doesn't grab?
On Tuesday, 5 January 2016 at 23:52:05 UTC, Basile B. wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s https://www.youtube.com/watch?v=YgSPaXgAdzE I'm a loser baby, so why don't you leave me ? You luv losers ? And you don't leave them ? Nurse syndrom. to the MI6: It's a english daddy boy who tought me what is a papirosn https://en.wikipedia.org/wiki/Belomorkanal TIP to englishmen: you should learn how to behave in France.
Re: Index a parameter tuple with a run-time index
On Friday, 15 January 2016 at 21:47:21 UTC, Justin Whear wrote: On Fri, 15 Jan 2016 20:52:46 +, Meta wrote: And of course I'm proven wrong as soon as I post :) Sometimes I forget how powerful D's code generation abilities are. Username doesn't check out, :( Huh?
Re: Index a parameter tuple with a run-time index
On Fri, 15 Jan 2016 20:52:46 +, Meta wrote: > And of course I'm proven wrong as soon as I post :) Sometimes I forget > how powerful D's code generation abilities are. Username doesn't check out, :(
Re: core.sys.posix.sys.ioctl
On Friday, 15 January 2016 at 21:21:26 UTC, sanjayss wrote: Is the contribution process straightforward. For this, yes. Should be able to just fork druntime and edit the ioctl.d that exists to flesh it out to be more complete. Make sure it matches the original C names, values, etc., and there should be no real friction in getting it in (just remember to use spaces rather than tabs lol)
Re: core.sys.posix.sys.ioctl
On Friday, 15 January 2016 at 18:34:14 UTC, Adam D. Ruppe wrote: On Friday, 15 January 2016 at 18:32:22 UTC, sanjayss wrote: Is there any reason that this module is not complete for platforms other than Linux Nobody has written it up, except the parts they use. Is the contribution process straightforward. Since I am mucking around in this area on OSX, I could attempt creating a more complete ioctl module for OSX...unless ofcourse someone else has already tried it and there are too many gotchas or there already have been too many discussions on the right way to do this and there is no consensus (I don't want to get into too much of these types of discussions -- not enough time).
Re: Index a parameter tuple with a run-time index
On Friday, 15 January 2016 at 20:48:39 UTC, anonymous wrote: On 15.01.2016 21:42, Nordlöw wrote: How do I index a function parameter tuple with a run-time index? With a switch and a static foreach: void f(A...)(size_t i, A a) { import std.stdio: writeln; switch_: switch (i) { foreach (iT, T; A) { case iT: writeln(T.stringof); break switch_; } default: writeln("??"); break; } } void main() { f(0, "foo", 42); /* string */ f(1, "foo", 42); /* int */ f(2, "foo", 42); /* ?? */ } And of course I'm proven wrong as soon as I post :) Sometimes I forget how powerful D's code generation abilities are.
Re: Index a parameter tuple with a run-time index
On Friday, 15 January 2016 at 20:42:47 UTC, Nordlöw wrote: How do I index a function parameter tuple with a run-time index? I believe it's impossible because a parameter tuple is not a runtime entity. If it was an expression tuple (a compile-time tuple of only values, no types or symbols) and all of the values had a common base type, you could put it in an array and index that.
Re: Index a parameter tuple with a run-time index
On 15.01.2016 21:42, Nordlöw wrote: How do I index a function parameter tuple with a run-time index? With a switch and a static foreach: void f(A...)(size_t i, A a) { import std.stdio: writeln; switch_: switch (i) { foreach (iT, T; A) { case iT: writeln(T.stringof); break switch_; } default: writeln("??"); break; } } void main() { f(0, "foo", 42); /* string */ f(1, "foo", 42); /* int */ f(2, "foo", 42); /* ?? */ }
Index a parameter tuple with a run-time index
How do I index a function parameter tuple with a run-time index?
Re: Voldemort Type Construction Error
On Friday, 15 January 2016 at 16:51:24 UTC, Anon wrote: On Friday, 15 January 2016 at 14:04:50 UTC, Nordlöw wrote: What have I missed? In line 126, `static struct Result()` is a template. Either drop the parens there, or change the call on line 187 to `Result!()(haystack, needles)`. Ahh, annoying mistake. Why is this allowed? /Per
Re: Glad and WGL
On Friday, 15 January 2016 at 07:37:27 UTC, Josh Phillips wrote: However I (of course) ran into new errors. Gl functions like glGetString and glGetIntegerv cause the program to crash. It appears that an opengl context is being created so I'm not sure whats causing the problem For anyone else with this issue I finally figured it out. You have to call gladLoadGL AFTER you set the glContext and before you call any gl code.
Re: DUB & Win-10 SDK / link lib not found
I also ran into this issue because I upgraded VS and removed the old version. A quick re-install with the dmd .exe fixed it.
Re: core.sys.posix.sys.ioctl
On Friday, 15 January 2016 at 18:32:22 UTC, sanjayss wrote: Is there any reason that this module is not complete for platforms other than Linux Nobody has written it up, except the parts they use.
core.sys.posix.sys.ioctl
Is there any reason that this module is not complete for platforms other than Linux -- the ioctl() system call is common across all Unix-like OSes, so it doesn't make sense that this is only partially supported. (I am using the latest DMD).
Re: Voldemort Type Construction Error
On Friday, January 15, 2016 14:04:50 Nordlöw via Digitalmars-d-learn wrote: > I've made progress at the helper findingSplitter at > > https://github.com/nordlow/justd/blob/master/substitution.d#L122 > > I need this for implementing a new Phobos lazy `substitute()` (or > replace). > > I've done most logic (AFAICT in my head) but I can't make the > call to Result() work as it fails as > > substitution.d(187,18): Error: struct > substitution.findingSplitter!("a == b", string, string, string, > string).findingSplitter.Result cannot deduce function from > argument types !()(string, string, string, string), candidates > are: > substitution.d(126,12):substitution.findingSplitter!("a > == b", string, string, string, string).findingSplitter.Result() > substitution.d(194,32): Error: template instance > substitution.findingSplitter!("a == b", string, string, string, > string) error instantiating > substitution.d(196,12): Error: undefined identifier 'equal', did > you mean alias 'Unqual'? > /home/per/Work/justd/traits_ex.d(64,13): Warning: statement is > not reachable > > What have I missed? Well, the last error is caused by not import equal in that code (since the imports that would import it are local imports elsewhere in the module). As for the main error, you have parens on the declaration of Result. static struct Result() I don't know why you put them there, since Result is already effectively templated by being inside of a templated function, and having it requires that Result than have !() as a template argument when you're constructing it. So, I'd say that you should just remove the parens - or if you have a good reason that I can't think of which makes it make sense to put the parens on Result, then you'll need to use !() when constructing it. In any case, having the parens there but not using !() when constructing the Result is what gives you the error you're seeing. If you remove the parens, you get something more like substitution.d(159): Error: template instance hasSlicing!R template 'hasSlicing' is not defined substitution.d(160): Error: template instance hasLength!R template 'hasLength' is not defined substitution.d(176): Error: static assert "Handle R without slicing" substitution.d(195):instantiated from here: findingSplitter!("a == b", string, string, string, string) Adding the appropriate imports results in something along the lines of substitution.d(177): Error: static assert "Handle R without slicing" substitution.d(196):instantiated from here: findingSplitter!("a == b", string, string, string, string) Beyond that, I'd have to figure out exactly what you're up to, but it looks like that static assert is probably there to indicate that code needs to be added as opposed to there being another bug that needs fixing. In any case, that should at least help you make progress. - Jonathan M Davis
Re: Voldemort Type Construction Error
On Friday, 15 January 2016 at 14:04:50 UTC, Nordlöw wrote: What have I missed? In line 126, `static struct Result()` is a template. Either drop the parens there, or change the call on line 187 to `Result!()(haystack, needles)`.
Re: DUB & Win-10 SDK / link lib not found
On 2016-01-15 00:36:57 +, Mike Parker said: Did you install DMD manually? In that case, you will usually need to edit sc.ini to point to the proper VC and Win SDK directories. The DMD installer should detect your installation and configure it for you. I use Digger, hence this might be the cause. And, if one changes the VS installation after installing DMD, the manual changes are necessary as well. It's just that you need to remember it. -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Re: c style casts
On 2016-01-15 11:16, Warwick wrote: I though C style casts were not supported? But when I accidentaly did int i; if (uint(i) < length) it compiled and worked fine. Whys that? Wouldn't a C style cast be: int i; if ((uint)i < length) ? -- /Jacob Carlborg
Voldemort Type Construction Error
I've made progress at the helper findingSplitter at https://github.com/nordlow/justd/blob/master/substitution.d#L122 I need this for implementing a new Phobos lazy `substitute()` (or replace). I've done most logic (AFAICT in my head) but I can't make the call to Result() work as it fails as substitution.d(187,18): Error: struct substitution.findingSplitter!("a == b", string, string, string, string).findingSplitter.Result cannot deduce function from argument types !()(string, string, string, string), candidates are: substitution.d(126,12):substitution.findingSplitter!("a == b", string, string, string, string).findingSplitter.Result() substitution.d(194,32): Error: template instance substitution.findingSplitter!("a == b", string, string, string, string) error instantiating substitution.d(196,12): Error: undefined identifier 'equal', did you mean alias 'Unqual'? /home/per/Work/justd/traits_ex.d(64,13): Warning: statement is not reachable What have I missed?
Re: c style casts
On Friday, 15 January 2016 at 10:16:41 UTC, Warwick wrote: I though C style casts were not supported? But when I accidentaly did int i; if (uint(i) < length) it compiled and worked fine. Whys that? This is not a cast. You call constructor `uint(int x)`. In the same time `uint(somethingTypeOfLong)` would not work, but cast(long). --Ilya
c style casts
I though C style casts were not supported? But when I accidentaly did int i; if (uint(i) < length) it compiled and worked fine. Whys that?