Project

General

Profile

Actions

Feature #8807

open

Custom literals

Added by trans (Thomas Sawyer) over 10 years ago. Updated over 3 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:56767]

Description

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"]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0