News for hackers. Stuff that matters.
Re:What are some of the most disliked programming languages? by pmontra on Wednesday November 01, 2017 @02:43AM (#15599228)
Ruby doesn't have macros and all the magic in its ecosystem is confined to Rails and the gems related to it. But most Rubyists are such because of Rails so that's understandable. Examples of the magic like features of Rails are ActiveRecord's auto discovery of db schema and auto creation of queries, or callbacks on the changes of status of db records. It's where programming in Rails becomes somewhat declarative.

But macros? A language with macros I'm working with is Elixir. Even the seldom used if then else is a macro there. Do people dislike Elixir because macros change the code at compile time? I don't think so.

Re:What are some of the most disliked programming languages? by shakna on Wednesday November 01, 2017 @04:26AM (#15599575)
> Ruby doesn't have macros and all the magic in its ecosystem is confined to Rails

Then what would you call the method_missing method?

> a b c

> = Name Error

> def method_missing(*args); args.join(" "); end

> a b c

> = "a b c"

That looks exactly like a macro to me.

---

> But macros?

Not macros as such, we all like having them. But Ruby likes using them constantly, and that culture is hardly restricted to Rails.

Re:What are some of the most disliked programming languages? by pmontra on Wednesday November 01, 2017 @06:18AM (#15599953)
I see your point but Matz was clear about adding macros to Ruby:

> Macro is a great power, but at the same time, it makes the languagesyntax different for each application. You will have hard time to read the program without knowledge of the application/framework macros.

> So I am not going to add macro to Ruby.

> matz.

https://www.ruby-forum.com/topic/215212

The funny thing is that this is what happens when we use method_missing or other Ruby features to create DLSes: unless you know the application/framework DLS you can't understand the program. They must be used wisely.

But to be fair: how can one understand a program without the knowledge of the non standard libraries it uses? This applies to every program and language, macros or not.

Re:What are some of the most disliked programming languages? by topaxi on Wednesday November 01, 2017 @04:34AM (#15599591)
Macros and meta-programming aren't necessarily the same.