The Retrospring servers are currently under heavy load from users migrating from CuriousCat. Unicorns might appear more frequently in the coming days. Follow us on Twitter to keep up to date.
Opinions on macros in programming?
Hmm... I'm not really a macro kind of person - generally speaking I'll just shove everything into a function - but I have no issues with them.
With that said, Crystal has only a few basic functions, and most other "functions" in the language are macros of those basic functions, which makes understanding what those functions actually do a whole lot easier and somewhat self-documenting, and I think that's really cool.
Just like almost everything in life, this type of stuff can be nice when used properly and only when appropriate, and otherwise can quickly be a recipe for disaster. Macros are one of those 'implicit' programming concepts, the stuff that you just can't notice by simply reading code, and I've been bit enough times by all kinds of implicit programming that I started actively avoiding that.
If your macro has some way to let developers notice that it is a macro just by reading the code where it is used, like how you will always notice a Python decorator or a C# attribute, then that's fine as long as the name of macro gives away what it does.
Macros that could even redefine the entire language, like how I saw a project recently just defining a int32
macro with different bit sizes depending on the platform, or macros that have names that cannot be read by any sane human being (as is the norm with everything in C/C++ apparently), are absolute hell.
Do you mean preprocessor macros, as found in C? They're pretty neat and allow code to be portable between lots of funky build systems, compilers, and platforms.
I'm not really a programmer anymore, I primarily read code nowadays. So to me, I prefer to not see macros since it adds difficulty when reading. But I just see my job like how a mechanic sees theirs, I just take whatever rolls into the shop and deal with it. The result is that I'm rather ambivalent on many programming preferences.
good
Retrospring uses Markdown for formatting
A blank line starts a new paragraph
*italic text*
for italic text
**bold text**
for bold text
[link](https://example.com)
for link