Hacker News new | ask | show | jobs
by moe 4144 days ago
It would be nice to refer to the variable name literally

No, it would not be nice. It would be in violation with basic ruby syntax.

If that is the best example you could come up with then I'm glad ruby does not allow whatever it is that you're asking for.

1 comments

>It would be in violation with basic ruby syntax.

But this isn't about regular Ruby syntax, this is about extending Ruby syntax by embedding new languages within it. A new language may have new evaluation rules. As another user points out, there's a syntax called 'alias' that works similarly to my example, so I disagree that it would be violating anything.

>I'm glad ruby does not allow whatever it is that you're asking for.

I'm essentially asking for macros commonly found in the Lisp family of languages.

there's a syntax called 'alias' that works similarly to my example

That's an unfortunate wart on the language (an inconsistency) and not related to your example at all.

I'm essentially asking for macros commonly found in the Lisp family of languages.

Can you come up with a real-world use case for that?