Frank Abelbeck · @frank
38 followers · 252 posts · Server troet.cafe

Woa, metaclass subclassing + keywords passing via __init_subclass__ is... weird, but powerful. 🙃

Took me some time to figure out that the keywords passed to __init_subclass__ propagate to the metaclass' __new__.

#metaprogramming #python #gdl90 #avgeek

Last updated 1 year ago

Frank Abelbeck · @frank
37 followers · 249 posts · Server troet.cafe

Programming in progress.

GDL90 message management.

First time using meta classes. Roughly thirty years of programming experience, half of it using Python, and still getting "firsts". 🙂

#metaprogramming #python #gdl90 #garmin #avgeek

Last updated 1 year ago

MrPowerShell · @MrPowerShell
148 followers · 235 posts · Server fosstodon.org

I ❤️ with and !

Went to work on:

github.com/StartAutomating/PSS

Its build turns MDN docs into 4mb of PowerShell to make a perfect wrapper for SVG.

SVG.image just wrote itself, because the standard updated 😀😉😎.

Metaprogramming FTW!

#metaprogramming #pipescript #powershell

Last updated 1 year ago

Mihai Lazarescu · @mtl
1 followers · 154 posts · Server techhub.social
kluka ❌ · @kluka
16 followers · 60 posts · Server ruby.social

@soulcutter "To hate metaprogramming is to hate Ruby. "

Awesome quote, I'll remember that

for me the big deal is consideration. In the popular & well tested gems results are nice to use.
In proprietary codebases of small teams things can get out of hand

#metaprogramming

Last updated 1 year ago

@mjgardner @matsuzine @Perl @EricCarroll There is another dimension that should also be considered here, that of productivity. Getting the prompting right for to generate a chunk of code that works & testing said code, may end up taking more time than actually doing the deed by hand. It makes more sense (IMHO as a hobbyist) to have good metadata about functionality for software libraries so that they can be located & reused, with generates the boilerplate.

#largelanguagemodel #metaprogramming

Last updated 1 year ago

kluka ❌ · @kluka
16 followers · 55 posts · Server ruby.social

Quite controversional opinions about on 😁

news.ycombinator.com/item?id=3

#metaprogramming #hackernews

Last updated 1 year ago

One of these days I really need to learn how to use code generation (didn’t people used to call it ?)

#metaprogramming

Last updated 1 year ago

📢New in MEAP📢

Supercharge your Rustlang code with macros—the real power tools of Rust!

Rust Power Tools by Sam Van Overmeire will help you push Rust to its full potential: mng.bz/8rjz

#rustlang #rust #rustprogramming #metaprogramming

Last updated 1 year ago

Oblomov · @oblomov
849 followers · 51458 posts · Server sociale.network

That being said, I'm actually among the perverts that are fascinated by (even though I'm well aware of its limitations pertaining readability and maintainability). Which is why I took @tess venting as an opportunity to challenge myself into writing a workable approach to generic properties for C++ objects with a common interface:

wok.oblomov.eu/tecnologia/cpp-

#templatemetaprogramming #oop #cplusplus #macros #property #tagclass #traits #templates #metaprogramming #interfaces

Last updated 1 year ago

Oblomov · @oblomov
849 followers · 51458 posts · Server sociale.network

But the biggest issue with C++ isn't just the syntax (that has been improving in the last years) and the errors. To paraphrase an XML joke, «C++ metaprogramming is like violence, if it doesn't solve your problems, you're not using enough of it.»
The moment you start using metaprogramming, it creeps into every corner of the code base, often requiring several layers of indirection and extensive auxiliary classes to achieve a relatively simple “user” interface.

#templates #metaprogramming

Last updated 1 year ago

Oblomov · @oblomov
849 followers · 51458 posts · Server sociale.network

One of the most controversial features in C++ is the hidden “language within the language” of templates —an emergent byproduct of the generics implementation from the first revisions of the language, that has been kept despite the obnoxious syntax for anything nontrivial and the complexity of the error messages when anything goes wrong. The resulting capabilities of C++ turn out to be surprisingly powerful while at the same time falling flat in the most unexpected of ways.

#metaprogramming

Last updated 1 year ago

Henrik Nyh · @henrik
218 followers · 668 posts · Server ruby.social

Since publishing thepugautomatic.com/2023/07/ru I’ve improved it, so have another look:

- Added a “Non-initializer builders” section based on comments from @maxim (thanks!)
- Added a “Module identity” section based on the same discussion
- This morning, after the penny dropped the rest of the way, I rewrote the initial “The instance-mixin duality” section extensively to hopefully be clearer.
- Also, a footnote!

#ruby #metaprogramming

Last updated 1 year ago

Henrik Nyh · @henrik
214 followers · 653 posts · Server ruby.social
PolitMatch · @politmatchmc
2 followers · 4 posts · Server lor.sh

Kotlin или Scala - и почему сервер будет написан почти полностью на втором.

Интересный вопрос - Kotlin или Scala.
У первого есть большая экосистема и все возможности для создания DSL (Domain Specific Language)-ов.
Но у второго есть почти вся система типов Rust (что для меня всегда является плюсом), например ассоциированные типы (trait A { type B }), или алгебраические типы данных (enum E { case I(int: Int); case B(bool: Boolean) }).

Без последнего жить можно, и аналог Jetpack Compose не везде можно встретить.
Но что стало для меня последней каплей для перехода на Scala - наличие макросов и аннотаций-макросов.

Уже написав примерно 1к строк Scala кода, я могу сказать что выбор был сделан правильно, ибо при наличии макросов и куда более развитой системе контекстов, extension'ов, адаптировать API написанные под Java (и добавлять свои приколы, например неявное преобразование шестнадцатеричных цветовых строк в объекты TextColor) стало намного легче. Тем более синтаксис "типа переменных" (def what: ReturnType) помогает намного больше чем я думал вначале.

Кстати, для разработчиков: я хоть и не буду опенсорсить сами плагины сервера, но некоторые части их (например gloryxlib, что-то типа слоя совместимости Sponge и Scala и вообще библиотека утилит) - на здоровье.
В gloryxlib скоро так же появится макрос, генерирующий DataManipulator'ы. (те кто знают, поймут боль.)

На сегодня болтовни про вещи которые игрокам скорее всего нафиг не сдались, хватит. Спасибо за внимание и приятной игры.

#politmatchdev #programming #scala #metaprogramming #kotlin

Last updated 1 year ago

Todd A. Jacobs · @todd_a_jacobs
8 followers · 69 posts · Server ruby.social

@zolyguy Lambdas are one of the reasons I've been thinking about writing a book about *why* (not how) to do certain things in certain ways in . There *are* legitimate use cases. They're just kind of niche, and most often part of some voodoo or the need to hack around crufty code.

Not yet convinced there's a big enough audience for that topic, though. There's probably a reason nobody else has written it yet. 🤣

#rubylang #metaprogramming

Last updated 1 year ago

Mark Gardner ‍:sdf: · @mjgardner
668 followers · 4200 posts · Server social.sdf.org

@ssfckdt Bondage-and-discipline languages at which you can throw waves of interchangeable newbies make life easier for business managers.

’s reputation was spoiled by waves of newbies producing bad code anyway during the early “Web 1.0” years, followed by a splintering of its core community as (now )’s long development Osborned it to outsiders.

It didn’t have much to do with its capabilities.

#programming #perl #perl6 #rakulang #metaprogramming

Last updated 1 year ago

GenghisKen Coar · @GenghisKen
91 followers · 366 posts · Server ruby.social

I'm kinda getting now, but not the rampant enthusiasm for it. AFAICS (and IMHO), is far superior in terms of , class vs instance scopes, and intuitively obvious object orientedness.

Maybe it's just Python's ubiquity that keeps it so.. ubiquitous. 🤔

#python #ruby #metaprogramming #objectoriented #oo

Last updated 1 year ago

Coral Kashri · @coral
0 followers · 15 posts · Server hachyderm.io

```
template auto func(Args... args) { return (args || ... ); }

std::cout << func("str");
```

Does it compile? What will be the output?

Answers in the article :)
cppsenioreas.wordpress.com/202

Special thanks for a lightning conversion Daisy Hollman!

#cpp #cppsenioreas #metaprogramming #programming #development

Last updated 1 year ago

yhm · @yhm
11 followers · 233 posts · Server social.dev-wiki.de


小结:

Elixir 中一切代码皆表达式(包括定义语句也是)

AST 是将代码的数据形式表达的有结构数据。

quote 是一个把表达式转换为对应 AST 的工具, 而unquote 是能把 AST 转换为表达式的工具(但被设计为并不能在所有位置使用)。

那么, quoted 描述的就是由表达式转换而来的 AST ,而 unquoted 描述的就是由这样的 AST 转换为的表达式。

macro 是类似于函数的一种东西可以传参可以指定返回。

macro 与函数的区别在于:参数方面,被作为参数传入 macro 的表达式,会被自动转换为 AST ,就好像这个表达式被 quote 了一样 —— 所以,你传入的表达式不会被运行,而只是被作为数据对待;而返回方面,在返回处指定的数据(或者一个会返回数据的表达式 …… 当然了你直接写的数据结构其实也可以视为一个得出它本身的表达式)将会在这个 macro 被调用时(这是在编译期),被尝试从 AST 转换为表达式,并填在你调用这个 macro 的位置。 —— 而这也就是 macro 的运行机制了。

看:传参的表达式会被自动变为 AST ,所以如果想把这个表达式拼接进某个位置就要先用 unquote 把它变回表达式;而返回位置需要指定一个 AST 数据,那么就用 quote 作用于某个表达式,你就能得到相应的 AST 数据了,因为 macro 的返回位置必须写能够作为 AST 的数据,因此用 quote 作用于表达式会是个不错的点子。

——————

#metaprogramming #elixir

Last updated 2 years ago