From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r114556: * test/indent/ruby.rb: Fix a spurious change, add more failing examples.
Date: Tue, 08 Oct 2013 02:05:03 +0300 [thread overview]
Message-ID: <87y564hecg.fsf@yandex.ru> (raw)
In-Reply-To: <jwv1u3x835v.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Mon, 07 Oct 2013 12:55:25 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> +z = {
>> + foo: {
>> + a: "aaa",
>> + b: "bbb"
>> + }
>> +}
>
> I think I've fixed this one, now.
Thanks.
>
>> +foo +
>> + bar
>
> This one makes no sense to me: as an instruction, it seems non-sensical
> (I assume addition is pure),
Not necessarily. Ruby has operator overloading:
irb(main):014:0> class C
irb(main):015:1> def +(other)
irb(main):016:2> puts "cowabunga!"
irb(main):017:2> end
irb(main):018:1> end
=> nil
irb(main):019:0> C.new + 3
cowabunga!
=> nil
(And there are such binary operators as << and >>, they are exprected to
modify the receiver).
Second, every statement in Ruby is an expression, and a function
implicitly returns its last expression. So a fuller example would be:
def five_times(bar)
bar + bar + bar + bar +
bar
end
This isn't indented right either.
> and this indentation seems incompatible
> with the previous examples like
>
> foo = x +
> y
Hopefully, it can be resolved in some way. I agree that
foo = x +
y
looks kinda ugly.
But FWIW, in open source code I see "hanging" expressions more often
outside of assignments than in them.
>> +foo if
>> + bar
>
> This is another case where implicit-semi-p needs to be refined.
I'm not sure I'm doing it right.
I've tried adding
(and (eq (car (syntax-after (1- (point)))) 2)
(equal (save-excursion (ruby-smie--backward-token))
"iuwu-mod"))
as a new case in ruby-smie--implicit-semi-p, but it doesn't seem to
have the desired (or any) effect.
next prev parent reply other threads:[~2013-10-07 23:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1VTAqX-0005m7-J3@vcs.savannah.gnu.org>
2013-10-07 16:55 ` [Emacs-diffs] trunk r114556: * test/indent/ruby.rb: Fix a spurious change, add more failing examples Stefan Monnier
2013-10-07 23:05 ` Dmitry Gutov [this message]
2013-10-08 3:37 ` Stefan Monnier
2013-10-09 3:27 ` Dmitry Gutov
2013-10-09 12:47 ` Stefan Monnier
2013-10-09 13:40 ` Dmitry Gutov
2013-10-09 18:24 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y564hecg.fsf@yandex.ru \
--to=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).