Re: Uninstalling DMG file
On Wednesday, 16 October 2019 at 02:30:58 UTC, Joel wrote: How would I go about uninstalling D's DMG file, (as I'm weary of installing it)? I usually, use Home Brew, but the lastest on that doesn't work (macOS Catalina). I guess I can just wipe off the executable files that DMG produces, aye? Ok, I've installed the latest (2.088.1) dmg file. It has an uninstall file in there. Everything seems to be working again - yay!
Uninstalling DMG file
How would I go about uninstalling D's DMG file, (as I'm weary of installing it)? I usually, use Home Brew, but the lastest on that doesn't work (macOS Catalina). I guess I can just wipe off the executable files that DMG produces, aye?
Re: Blog Post #79: Notebook, Part III - Customized Tabs, Part I
On Tuesday, 15 October 2019 at 20:03:00 UTC, Ron Tarrant wrote: On Tuesday, 15 October 2019 at 14:00:32 UTC, WebFreak001 wrote: thank you so much for these tutorials! I love how they are progressing. Thanks, WebFreak001. Small, simple and concise topics with good images, nice drawings, and most importantly, paragraphs explaining the logic along with the code. I am also fan of your consistent style of the website and the tutorial images. Keep up the great work on these tutorials! They are a great resource showing people how to easily do great GUIs in D and will surely attract a lot of people. Those are some very kind words. Thank you very much. Could you maybe do a tutorial how to use Glade with D in the future? I'll put this on my todo list. How could I turn you down after the preamble you wrote? :) there are 2 dub packages to generate D code from the forms files. (one very new one with nice explanations and one that is a year old with a bit less documentation) Do you have links for these? thanks! :p both the packages can simply be found on dub: https://code.dlang.org/search?q=glade Not sure if there are other ways like directly loading an XML in GTK, haven't looked into it too much yet because I am not so often building GTK GUI applications, but with the new Linux Phones on the market (Librem 5, PinePhone) running GTK Apps natively and really needing some Apps those will be great platforms to start app development on.
Re: Blog Post #79: Notebook, Part III - Customized Tabs, Part I
On Tuesday, 15 October 2019 at 14:00:32 UTC, WebFreak001 wrote: thank you so much for these tutorials! I love how they are progressing. Thanks, WebFreak001. Small, simple and concise topics with good images, nice drawings, and most importantly, paragraphs explaining the logic along with the code. I am also fan of your consistent style of the website and the tutorial images. Keep up the great work on these tutorials! They are a great resource showing people how to easily do great GUIs in D and will surely attract a lot of people. Those are some very kind words. Thank you very much. Could you maybe do a tutorial how to use Glade with D in the future? I'll put this on my todo list. How could I turn you down after the preamble you wrote? :) there are 2 dub packages to generate D code from the forms files. (one very new one with nice explanations and one that is a year old with a bit less documentation) Do you have links for these?
Re: Permission to Use Comments?
On Monday, 14 October 2019 at 15:36:44 UTC, Jesse Phillips wrote: Pretty sure since this is a public forum, legally you just need to reference your sources (if even that). Asking permission is just polite. Well, yes and no. According to the FTC (U.S.) and the Federal Competition Bureau (Canada) it's best to get permission in written form, even if it's email or on a public forum, no matter what the source of the comments. It's polite, yes, but it also removes ambiguity. I don't say anything good, but you're free to use mine. :) Why, thanks, Jesse.
Re: Permission to Use Comments?
On Tuesday, 15 October 2019 at 14:33:27 UTC, Russel Winder wrote: Not I. I am happy for comments I make regarding GtkDCoding on this email list to be used above my name on the GtkDCoding website. Thanks, Russel.
Re: Mixin and introspection ordering
On Tuesday, 15 October 2019 at 19:19:58 UTC, Sebastiaan Koppe wrote: You would expect 2 to print `tuple(a)` as well, but it doesn't. Don't know if it is a bug. Any time you use a construct that mutates the AST (template mixin, string mixin, static if, static foreach), it's possible to catch it in both "before" and "after" states. For example: pragma(msg, __traits(allMembers, S1).stringof); // tuple() struct S1 { mixin("int n;"); } pragma(msg, __traits(allMembers, S1).stringof); // tuple("n") pragma(msg, __traits(allMembers, S2).stringof); // tuple() struct S2 { static foreach (_; 0 .. 1) int n; } pragma(msg, __traits(allMembers, S2).stringof); // tuple("n") This can cause some "interesting" things to happen when using templates like the ones in std.traits to do reflection, since the result of template instantiation is cached: import std.traits: hasMember; struct S3() { static if (!hasMember!(S3, "b")) { int a; } mixin("int b;"); } pragma(msg, hasMember!(S3!(), "b")); // false pragma(msg, __traits(allMembers, S3!())); // tuple("a", "b")
Mixin and introspection ordering
Sometimes ordering is important when combining mixins and introspection, this is another such case: ``` import std.traits; enum myuda; mixin template Slot(string name) { mixin("@myuda int "~name~";"); } struct OuterOption { mixin Slot!"a"; } struct App { pragma(msg, getSymbolsByUDA!(OuterOption, myuda).stringof); // 1. prints 'tuple(a)' // pragma(msg, getSymbolsByUDA!(InnerOption, myuda).stringof); // 2. prints '()' struct InnerOption { mixin Slot!"a"; } pragma(msg, getSymbolsByUDA!(InnerOption, myuda).stringof); // 3. prints 'tuple(a)' } ``` You would expect 2 to print `tuple(a)` as well, but it doesn't. Don't know if it is a bug.
Re: Get variable symbol name that was passed to a paramater?
So, 6 years later, what is the idiomatic way of doing this? Has there been any progress on this matter? As far as I can tell from this thread, all proposed solutions are imperfect in some way, which is a shame for a language with "Second to none reflection". Arredondo. On Saturday, 9 November 2013 at 09:12:21 UTC, Rob T wrote: I have a template function called "inspect" that takes two variables as arguments, void inspect(T)( string symbol, T value ) { writeln(symbol, " = ", value); } int y = 100; inspect( y.stringof, y ); writes to console y = 100 I am wondering if there's a way to pass only the variable and have the inspect function determine the variable's symbol name as passed rather than have to pass both the name and value separately? void inspect(T)( T value ) { writeln( ? , " = ", value); } I've tried a template with alias parameter void inspect(alias value)() { writeln( value.stringof , " = ", value); } It works except when passing a variable contained inside a struct or class due to a missing "this" during evaluation, I'm also worried about template bloat. I figure mixins may help, but not if it's same or less convenient to use as the double entry method. Any suggestions, or is it just impossible or not worth trying? --rt
Re: Permission to Use Comments?
On Mon, 2019-10-14 at 15:36 +, Jesse Phillips via Digitalmars-d-learn wrote: […] > Pretty sure since this is a public forum, legally you just need > to reference your sources (if even that). Asking permission is > just polite. […] But the forum/email list does not have terms of use that transfer copyright from the writer to the owner of the server hosting the forum/email list. Literary works are copyright the writer unless they give up that copyright. But IANAL. Quoting short parts of a literary work with attribution is clearly fair use – at least in the jurisdictions I know about, there may be some jurisdictions in which this doesn't apply. Asking permission guarantees no future copyright case brought against you. -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: A proper WAT moment
On Tuesday, 15 October 2019 at 09:34:41 UTC, Simen Kjærås wrote: void fun() { pragma(msg, __LINE__, " ", __traits(compiles,__traits(getMember, S, "e"))); } __traits(compiles) is lying to you again. If you replace it with __traits(getMember, S, "e") ...you'll get an error. Interestingly, the code does of course actually compile: struct S3 { void fun() { alias a = __traits(getMember, S, "e"); } } I think this is the key. It compiles if you put it on the right-hand side of an alias declaration, but *not* if you write it as a bare expression: struct S3 { void fun() { __traits(getMember, S, "e"); // Error } } The difference is that in an alias declaration, __traits(getMember) isn't evaluated as a function call, whereas in a naked expression, it is. So the question becomes, why is __traits(getMember) evaluating @property functions differently in different contexts? I suspect the answer has to do with the difference between the two error messages. In the context of a free function, it's "need `this` for `e`"--i.e., you're calling a member function without a receiver--so the compiler can infer that you didn't mean to call the function at all. In the context of a member function, however, it's "`this` needs to be type `S`, not `S2`"--i.e., you're (implicitly) calling a member function on the wrong type of receiver--so the compiler treats it the same as any other function call with incorrect arguments, and assumes you actually meant it. Of course, this is speculation; it would take looking at the compiler source to be sure.
Re: Permission to Use Comments?
On Mon, 2019-10-14 at 11:14 +, Ron Tarrant via Digitalmars-d-learn wrote: […] > 1) Does anyone know how copyright laws stand regarding reuse of > comments on a forum? IANAL, but… I believe emails, and I suspect forum posts, are copyright since they are literary works. Quoting them with reference to the original source is, I believe, fair use. But that depends on the jurisdiction. For forums I would guess that the jurisdiction of the server handling the UI (and possibly the one holding the storage if different) is the jurisdiction for copyright law. For emails it is likely weird, and not at all obvious. > 2) Does anyone object to me quoting them for promotional purposes? Not I. I am happy for comments I make regarding GtkDCoding on this email list to be used above my name on the GtkDCoding website. -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: Blog Post #79: Notebook, Part III - Customized Tabs, Part I
On Tuesday, 15 October 2019 at 12:07:22 UTC, Ron Tarrant wrote: Well, if that title isn't confusing, I'm not doing my job right. Today's post starts a three-part mini-series within the Notebook series on building customized tabs in a DrawingArea. There's a ton of stuff to go over; that's why it's in three parts. Anyway, the fun begins right here: https://gtkdcoding.com/2019/10/15/0079-notebook-iii-custom-tabs-i.html thank you so much for these tutorials! I love how they are progressing. Small, simple and concise topics with good images, nice drawings, and most importantly, paragraphs explaining the logic along with the code. I am also fan of your consistent style of the website and the tutorial images. Keep up the great work on these tutorials! They are a great resource showing people how to easily do great GUIs in D and will surely attract a lot of people. Could you maybe do a tutorial how to use Glade with D in the future? Glade is a visual GTK forms editor and there are 2 dub packages to generate D code from the forms files. (one very new one with nice explanations and one that is a year old with a bit less documentation) I don't really have too much experience with Glade but I'm sure a little bit of entry level Glade tutorial alongside with how to directly use it in D will surely attract a lot of people!
Re: Blog Post #77: Notebook, Part I
On Wednesday, 9 October 2019 at 03:13:48 UTC, GreatSam4sure wrote: Is there any way to detect the size of my screen using gtkd? So that incan calculate the size of my screen and center my window on the screen using move(x, y). I was distracted last time I replied to this thread and so overlooked the obvious. This is actually very simple to do. Add this to your Window or MainWindow constructor: Window.setPosition(WindowPosition.CENTER); That's it. Here's a full example, so you can see it in its natural habitat: https://github.com/rontarrant/gtkDcoding/blob/master/001_window/window_001_11_centered.d
Blog Post #79: Notebook, Part III - Customized Tabs, Part I
Well, if that title isn't confusing, I'm not doing my job right. Today's post starts a three-part mini-series within the Notebook series on building customized tabs in a DrawingArea. There's a ton of stuff to go over; that's why it's in three parts. Anyway, the fun begins right here: https://gtkdcoding.com/2019/10/15/0079-notebook-iii-custom-tabs-i.html
Re: A proper WAT moment
On Tuesday, 15 October 2019 at 07:06:35 UTC, John Colvin wrote: On Monday, 14 October 2019 at 19:45:11 UTC, Paul Backus wrote: On Monday, 14 October 2019 at 17:00:56 UTC, John Colvin wrote: Different ability to access a property depending if I'm inside something else when I look? [snip] You're attempting to call one of S's member functions without an instance of S to call it on. [snip] The real issue here is that the first `__traits(compiles)` check succeeds, even though the actual expression fails. And all the other ones in my example that access members without an instance that also compile? There's something pretty strange about the rules here. Yeah, Paul's wrong here - the struct is what messes things up here, though I don't understand why. Just putting the first function inside a struct cause the exact same issue: struct S { int a; int e() @property { return a; } } pragma(msg, __LINE__, " ", __traits(compiles,__traits(getMember, S, "e"))); void fun() { pragma(msg, __LINE__, " ", __traits(compiles,__traits(getMember, S, "e"))); } struct S2 { void fun() { pragma(msg, __LINE__, " ", __traits(compiles,__traits(getMember, S, "e"))); } } Interestingly, the code does of course actually compile: struct S3 { void fun() { alias a = __traits(getMember, S, "e"); } }
Re: Undefined symbol: _dyld_enumerate_tlv_storage (OSX)
On Monday, 14 October 2019 at 18:49:04 UTC, Jacob Carlborg wrote: On 2019-10-14 07:36, Joel wrote: I use Home Brew (brew upgrade dmd, and brew upgrade dub) Brew is only up to 2.087.1 at the moment - John Colvin seems to be the man that mantains dmd with brew. You can use DVM [1] to install the latest version of DMD. [1] https://github.com/jacob-carlborg/dvm I added an issue for DVM under: 'macOS Cataline'
Re: Undefined symbol: _dyld_enumerate_tlv_storage (OSX)
On Monday, 14 October 2019 at 18:49:04 UTC, Jacob Carlborg wrote: On 2019-10-14 07:36, Joel wrote: I use Home Brew (brew upgrade dmd, and brew upgrade dub) Brew is only up to 2.087.1 at the moment - John Colvin seems to be the man that mantains dmd with brew. You can use DVM [1] to install the latest version of DMD. [1] https://github.com/jacob-carlborg/dvm I started an issue for DVM under: 'macOS Cataline'
Re: A proper WAT moment
On Monday, 14 October 2019 at 19:45:11 UTC, Paul Backus wrote: On Monday, 14 October 2019 at 17:00:56 UTC, John Colvin wrote: Different ability to access a property depending if I'm inside something else when I look? [snip] You're attempting to call one of S's member functions without an instance of S to call it on. Reduced version: struct S { int a; int e() @property { return a; } } void foo(S s) { pragma(msg, __LINE__, " ", __traits(compiles, S.e)); // true (???) S.e; // Error: need `this` for `e` of type `@property int()` } struct C { void foo(S s) { pragma(msg, __LINE__, " ", __traits(compiles, S.e)); // false S.e; // Error: `this` for `e` needs to be type `S` not type `C` } } The real issue here is that the first `__traits(compiles)` check succeeds, even though the actual expression fails. And all the other ones in my example that access members without an instance that also compile? There's something pretty strange about the rules here.