Forum: Ruby-core [ruby-trunk - Feature #8807][Open] Custom literals

C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 trans (Thomas Sawyer) (Guest)
on 2013-08-21 11:21
(Received via mailing list)
Issue #8807 has been reported by trans (Thomas Sawyer).

----------------------------------------
Feature #8807: Custom literals
https://bugs.ruby-lang.org/issues/8807

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: current: 2.1.0


So why can't we define custom literals? There's been recent discussion
about adding a new freeze literal. Would have been nice if coders could
have defined it for themselves, then it would have been more clear if
there really was enough use to add it to core.

I imagine the syntax of such a feature to be quite simple.

  def %foo(string, mod=nil)
    p [string, mod]
  end

  %foo{something}o
  => ["something", "o"]
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-08-21 21:56
(Received via mailing list)
Issue #8807 has been updated by drbrain (Eric Hodel).


If you define a new literal in file "a.rb" you cannot use it in that
file that defined it as it has already been parsed. This may be
confusing.
----------------------------------------
Feature #8807: Custom literals
https://bugs.ruby-lang.org/issues/8807#change-41318

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: current: 2.1.0


So why can't we define custom literals? There's been recent discussion
about adding a new freeze literal. Would have been nice if coders could
have defined it for themselves, then it would have been more clear if
there really was enough use to add it to core.

I imagine the syntax of such a feature to be quite simple.

  def %foo(string, mod=nil)
    p [string, mod]
  end

  %foo{something}o
  => ["something", "o"]
Df9d48b6e2ae6cdedf4c39c2e58df851?d=identicon&s=25 boris_stitnicky (Boris Stitnicky) (Guest)
on 2013-09-03 04:07
(Received via mailing list)
Issue #8807 has been updated by boris_stitnicky (Boris Stitnicky).


-1
----------------------------------------
Feature #8807: Custom literals
https://bugs.ruby-lang.org/issues/8807#change-41547

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: current: 2.1.0


So why can't we define custom literals? There's been recent discussion
about adding a new freeze literal. Would have been nice if coders could
have defined it for themselves, then it would have been more clear if
there really was enough use to add it to core.

I imagine the syntax of such a feature to be quite simple.

  def %foo(string, mod=nil)
    p [string, mod]
  end

  %foo{something}o
  => ["something", "o"]
9361878d459f1709feec780518946ee5?d=identicon&s=25 naruse (Yui NARUSE) (Guest)
on 2013-10-01 10:11
(Received via mailing list)
Issue #8807 has been updated by naruse (Yui NARUSE).

Target version changed from current: 2.1.0 to Next Major


----------------------------------------
Feature #8807: Custom literals
https://bugs.ruby-lang.org/issues/8807#change-42146

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: Next Major


So why can't we define custom literals? There's been recent discussion
about adding a new freeze literal. Would have been nice if coders could
have defined it for themselves, then it would have been more clear if
there really was enough use to add it to core.

I imagine the syntax of such a feature to be quite simple.

  def %foo(string, mod=nil)
    p [string, mod]
  end

  %foo{something}o
  => ["something", "o"]
This topic is locked and can not be replied to.