nimpy icon indicating copy to clipboard operation
nimpy copied to clipboard

Some Macros for Subclassing

Open glyh opened this issue 4 years ago • 2 comments

Here's a snippt of the macros on GIST. Ideas are based on #228 .

(I've included some tests at the end)

As we've mentioned, this sugar is useful because many APIs requires user to implement subclasses of abstract classes.

glyh avatar Dec 24 '21 05:12 glyh

Some other examples:

glyh avatar Dec 24 '21 05:12 glyh

@glyh good job! I would not call it canonical syntax by no means, but it's definitely quite an improvement over my variant :). How about making a separate nimble package (nimpy_inheritance?) and I'll refer it in the README?

yglukhov avatar Feb 02 '22 07:02 yglukhov