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
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
I ❤️#Metaprogramming with #PipeScript and #PowerShell!
Went to work on:
https://github.com/StartAutomating/PSSVG
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
#MetaGPT #framework can build #webapps with #textprompts, #nocoding needed. Just describe what you want in #naturallanguage and it uses #LLMs and #SOPs to coordinate multiple #agents with different #roles and tasks. #AI #GPT #metaprogramming #opensource
https://www.marktechpost.com/2023/08/09/meet-metagpt-the-open-source-ai-framework-that-transforms-gpts-into-engineers-architects-and-managers/
#metagpt #framework #webapps #textprompts #nocoding #naturallanguage #LLMs #sops #agents #roles #AI #gpt #metaprogramming #opensource
@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 #metaprogramming results are nice to use.
In proprietary codebases of small teams things can get out of hand
@mjgardner @matsuzine @Perl @EricCarroll There is another dimension that should also be considered here, that of productivity. Getting the prompting right for #largelanguagemodel 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 #metaprogramming generates the boilerplate.
#largelanguagemodel #metaprogramming
One of these days I really need to learn how to use code generation (didn’t people used to call it #metaprogramming?)
📢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: http://mng.bz/8rjz
#rustlang #rust #rustprogramming #metaprogramming
That being said, I'm actually among the perverts that are fascinated by #templateMetaProgramming (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:
http://wok.oblomov.eu/tecnologia/cpp-template-properties/
#OOP #CPlusPlus #macros #property #tagClass #traits #templates #metaprogramming #interfaces
#templatemetaprogramming #oop #cplusplus #macros #property #tagclass #traits #templates #metaprogramming #interfaces
But the biggest issue with C++ #templates #metaprogramming 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.
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 #metaprogramming capabilities of C++ turn out to be surprisingly powerful while at the same time falling flat in the most unexpected of ways.
Since publishing https://thepugautomatic.com/2023/07/ruby-module-builder-patterns 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!
I blogged: “Ruby Module Builder patterns”
https://thepugautomatic.com/2023/07/ruby-module-builder-patterns/
#PolitMatchDev #programming #scala #metaprogramming #kotlin
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
@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 #RubyLang. There *are* legitimate use cases. They're just kind of niche, and most often part of some #metaprogramming 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. 🤣
@ssfckdt Bondage-and-discipline #programming languages at which you can throw waves of interchangeable newbies make life easier for business managers.
#Perl’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 #Perl6 (now #RakuLang)’s long development Osborned it to outsiders.
It didn’t have much to do with its #metaprogramming capabilities.
#programming #perl #perl6 #rakulang #metaprogramming
I'm kinda getting #Python now, but not the rampant enthusiasm for it. AFAICS (and IMHO), #Ruby is far superior in terms of #metaprogramming, 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
```
template auto func(Args... args) { return (args || ... ); }
std::cout << func("str");
```
Does it compile? What will be the output?
Answers in the article :)
https://cppsenioreas.wordpress.com/2023/05/22/into-the-extreme-fold-expressions/
Special thanks for a lightning conversion Daisy Hollman!
#cpp #cppsenioreas #metaprogramming #programming #development
#cpp #cppsenioreas #metaprogramming #programming #development
小结:
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 作用于表达式会是个不错的点子。
——————