www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - I learned something new in D this week! (anonymous class rundown)

reply Adam D. Ruppe <destructionator gmail.com> writes:
Many of you know I've been around D for a long time now and 
picked up a lot of random tricks over the years, so it isn't 
every day I learn about a new old feature in the language's basic 
syntax.

Would you like to know more?

http://dpldocs.info/this-week-in-d/Blog.Posted_2021_02_15.html

I also showed how you can use anonymous classes in betterC 
without any crazy hacks btw!


Lately most my blog posts have just been quick updates on what 
features are coming in my libraries, but I still write these more 
general-knowledge kind of tips from time to time. (and sometimes 
the lib entries can be generally educational too like my little 
attempt at demystifying fibers a couple months ago: 
http://dpldocs.info/experimental-docs/arsd.fibersocket.html#conceptual-overview
)
Feb 17 2021
next sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Thursday, 18 February 2021 at 04:31:39 UTC, Adam D. Ruppe 
wrote:
 Many of you know I've been around D for a long time now and 
 picked up a lot of random tricks over the years, so it isn't 
 every day I learn about a new old feature in the language's 
 basic syntax.

 Would you like to know more?

 http://dpldocs.info/this-week-in-d/Blog.Posted_2021_02_15.html

 I also showed how you can use anonymous classes in betterC 
 without any crazy hacks btw!


 Lately most my blog posts have just been quick updates on what 
 features are coming in my libraries, but I still write these 
 more general-knowledge kind of tips from time to time. (and 
 sometimes the lib entries can be generally educational too like 
 my little attempt at demystifying fibers a couple months ago: 
 http://dpldocs.info/experimental-docs/arsd.fibersocket.html
conceptual-overview )
Delivering as usual 👑
Feb 17 2021
prev sibling next sibling parent reply Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
On Thursday, 18 February 2021 at 04:31:39 UTC, Adam D. Ruppe 
wrote:
 Many of you know I've been around D for a long time now and 
 picked up a lot of random tricks over the years, so it isn't 
 every day I learn about a new old feature in the language's 
 basic syntax.

 Would you like to know more?

 http://dpldocs.info/this-week-in-d/Blog.Posted_2021_02_15.html

 I also showed how you can use anonymous classes in betterC 
 without any crazy hacks btw!


 Lately most my blog posts have just been quick updates on what 
 features are coming in my libraries, but I still write these 
 more general-knowledge kind of tips from time to time. (and 
 sometimes the lib entries can be generally educational too like 
 my little attempt at demystifying fibers a couple months ago: 
 http://dpldocs.info/experimental-docs/arsd.fibersocket.html
conceptual-overview )
I came across anonymous classes by reading your minigui codes, such as [1] some time ago. I did not read anything about them except your sources. Good reading, thanks. [1] https://github.com/adamdruppe/arsd/blob/master/minigui.d#L452
Feb 17 2021
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 18 February 2021 at 07:28:27 UTC, Ferhat KurtulmuÅŸ 
wrote:
 I came across anonymous classes by reading your minigui codes, 
 such as [1] some time ago. I did not read anything about them 
 except your sources. Good reading, thanks.
Yeah, I sometimes see them on lists of features to be cut from D since they aren't well known, but I'd miss them if they were gone. It isn't terribly important but I find them pretty convenient.
Feb 18 2021
prev sibling next sibling parent reply Ritter <rit-ter mail.ru> writes:
On Thursday, 18 February 2021 at 04:31:39 UTC, Adam D. Ruppe 
wrote:
 Many of you know I've been around D for a long time now and
Somebody from russian D's Telegram channel translates your article into Russian. Maybe, it can be usefull https://disk.yandex.ru/i/uVk9CgUUwFLzEg
Feb 18 2021
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 18 February 2021 at 16:54:31 UTC, Ritter wrote:
 Somebody from russian D's Telegram channel translates your 
 article into Russian. Maybe, it can be usefull
Nice!
Feb 18 2021
prev sibling next sibling parent reply superbomba <sb mail.com> writes:
On Thursday, 18 February 2021 at 04:31:39 UTC, Adam D. Ruppe 
wrote:
 ...
I'd like to report a problem with your blog... Once I start reading, I can't stop! :) Very nice work! superbomba.
Feb 18 2021
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 18 February 2021 at 22:37:06 UTC, superbomba wrote:
 Once I start reading, I can't stop! :)
Better be careful, there's about 250 entries now so you could waste away trying to read it all! (About 145 in twid's first iteration and now about 115 in the second iteration. Of course most of them are probably pretty boring, but like skimming the old iteration's tip of the week index here http://arsdnet.net/this-week-in-d/totw-index.html might be educational too. I need to index out the old interviews and such too, my stuff is easy enough if you keep up with it but it has poor searchability/skim ease looking back on it.)
Feb 18 2021
prev sibling next sibling parent Mike Parker <aldacron gmail.com> writes:
On Thursday, 18 February 2021 at 04:31:39 UTC, Adam D. Ruppe 
wrote:

 Would you like to know more?

 http://dpldocs.info/this-week-in-d/Blog.Posted_2021_02_15.html
It's on /r/programming here: https://www.reddit.com/r/programming/comments/lnhuts/anonymous_classes_in_d/
Feb 19 2021
prev sibling parent reply Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Thursday, 18 February 2021 at 04:31:39 UTC, Adam D. Ruppe 
wrote:
 Many of you know I've been around D for a long time now and 
 picked up a lot of random tricks over the years, so it isn't 
 every day I learn about a new old feature in the language's 
 basic syntax.

 Would you like to know more?

 http://dpldocs.info/this-week-in-d/Blog.Posted_2021_02_15.html

 I also showed how you can use anonymous classes in betterC 
 without any crazy hacks btw!


 Lately most my blog posts have just been quick updates on what 
 features are coming in my libraries, but I still write these 
 more general-knowledge kind of tips from time to time. (and 
 sometimes the lib entries can be generally educational too like 
 my little attempt at demystifying fibers a couple months ago: 
 http://dpldocs.info/experimental-docs/arsd.fibersocket.html
conceptual-overview )
DWT users knew about anonymous classes as they are used a lot there. Of course as SWT is a Java based library, D had to had the features to ease the porting.
Feb 19 2021
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 19 February 2021 at 17:41:51 UTC, Patrick Schluter 
wrote:
 DWT users knew about anonymous classes as they are used a lot 
 there. Of course as SWT is a Java based library, D had to had 
 the features to ease the porting.
Aye, my understanding is actually they were added to do specifically at the request of the DWT porters. Did you know about the constructor args though? That's what was new to me, I always thought you had to do a zero-arg constructor in the anonymous class (which works 99% of the time anyway.)
Feb 19 2021