ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: hanmac@gmx.de
To: ruby-core@ruby-lang.org
Subject: [ruby-core:71677] [Ruby trunk - Feature #11734] Improved ternary operator
Date: Wed, 25 Nov 2015 05:10:36 +0000	[thread overview]
Message-ID: <redmine.journal-55079.20151125051036.513f7d8db05968f3@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11734.20151124143335@ruby-lang.org

Issue #11734 has been updated by Hans Mackowiak.


@Daniel: _ with previous line result is a feature of IRB and PRY not ruby itself

----------------------------------------
Feature #11734: Improved ternary operator
https://bugs.ruby-lang.org/issues/11734#change-55079

* Author: Yurko Bregey
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
In ternary operator it would be nice to be able to pass expression result from *condition*  into *value_if_true/value_if_false* in such way:

`some_long_expression ? &.to_s : 'foobar'`
where `&` refers to `some_long_expression`

Instead of doing:
`some_long_expression ? some_long_expression.to_s : 'foobar'`

or:
`result = some_very_very_long_expression
result ? result.to_s : 'foobar'`



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2015-11-25  4:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11734.20151124143335@ruby-lang.org>
2015-11-24 14:33 ` [ruby-core:71650] [Ruby trunk - Feature #11734] [Open] Improved ternary operator bregey
2015-11-24 15:10 ` [ruby-core:71651] [Ruby trunk - Feature #11734] " hanmac
2015-11-24 20:28 ` [ruby-core:71662] " 6ftdan
2015-11-25  5:10 ` hanmac [this message]
2015-11-25  9:34 ` [ruby-core:71679] " nobu
2015-11-25 10:06 ` [ruby-core:71680] " bregey
2015-11-25 10:23 ` [ruby-core:71681] " bregey
2015-11-25 13:00 ` [ruby-core:71683] " hanmac
2015-12-07  7:52 ` [ruby-core:71892] [Ruby trunk - Feature #11734] [Closed] " ko1

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-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-55079.20151125051036.513f7d8db05968f3@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /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.
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).