Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Yo dog. I heard you like macros. So I put macros in your macros, so you can be confused while you're confused.
Beats DSLs though.
Domain Specific Languages, not Dick Sucking Lips. -
@Wisecrack Let me tell you that I absolutely hate C/C++/Objective-C macros.
Swift macros are much better. The main goal is to reduce error prone boilerplate. So, the code can get even less confusing and safer. -
@Lensflare I look at templating and macros and just think of it as bandaid solution to features that should have been included in a language to begin with.
Only exception I can see to this are the ones that let you add syntax that modifies the AST, so you can add language features over time, instead of having to modify the syntax directly.
Shit, did I just describe a DSL? I think I just described a DSL. -
@Wisecrack kind of. Some potential language features would be very specific to a domain or use case. And adding them all to the language would bloat the language. So macros are a nice way to let devs make their own extensions and features to the language. And use them selectively via plugins.
Related Rants
For a long time I wanted to have the possibility in Swift to copy instances of value types by just changing the value of one property (member variable).
Something like Kotlin's copy function.
And now that Swift has macros (like Rust), I made a macro for that! 😄
https://github.com/WilhelmOks/...
random
swift
kotlin
copy
macro