emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Small improvements to ruby-mode


From: Bozhidar Batsov
Subject: Re: Small improvements to ruby-mode
Date: Mon, 24 Jun 2013 16:49:31 +0300


On Sunday, June 23, 2013 at 3:30 PM, Dmitry Gutov wrote:
On 23.06.2013 10:20, Bozhidar Batsov wrote:
I'm less sure about these. Every method on Kernel is usually called
without an explicit receiver, and there are more of them.
Let's wait for another opinion.
There are more of them, but most of them exist only when ruby is invoked
with -n/-p (for perl-like scripting) - normally chomp, chomp!, chop, etc
are not bound, which means we should not add them to the built-in list,
since nobody is actually wring Ruby applications using them. Matz
himself recommends that all the command-like methods from Kernel be
treated as reserved words - meaning it's considered a bad idea for
someone to introduce variables or methods named this way. If they were
highlighted properly fewer developers would fail to recognize their
"special" status. Looking at the Kernel module's docs there are less
than 30 such commands and they've barely changed in recent years.

That makes sense, but should we highlight them the same way as
keyword-like methods (which I've roughly defined for myself as stuff
having to do with control flow, code generation and loading)?
Those methods are only different in our minds - in the end of the time they are in the same bucket. That said we have two options:

1. Introduce some extra face for keyword-like built-in methods, that inherits from the keyword or built-in face by default and leave it to theme authors to make it distinct.  
2. Treat all built-ins as just built-ins.

I'm fine with both options, but if it were up-to-me I'd probably go with option 2, since I don't like to introduce additional complexity and option 2 corresponds more closely with the actual state of affairs.

1) I don't subscribe to your principle of single quotes vs. double
quotes. So, when I'm adding an interpolation to a string, it's usually
double-quoted already.
It's not exactly my principle :-)

Well, it's in the style guide you're maintaining, and I haven't seen
this exact phrasing elsewhere, IIRC. And there are enough popular
projects that contradict or ignore it.

The toggling between string and symbol is pretty useful.

Yes, I could've used it myself just the other day. It's not something I
do too often either, though.

Btw, Dmitry, I noticed something strange about ruby-mode (at least in
24.3) - the calculations for method and block boundaries seem to be off.
I'm not sure if you're aware of the problem or you need a more detailed
report.

Not exactly sure what you mean, so yes, more details would be helpful.
But please try the current trunk first.
OK, I'll do some tests and I'll get back to you on this one. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]