Can you use this to do more advanced things like make new F<String,
Integer>() { public Integer f(String s) { return s.length(); } } look
like s => s.length() ?
2009/6/10 Ray Racine <
ray.racine@...>:
> For what its worth you can do this with emacs using compose region. You
> tell emacs to display a substitute for a string in a buffer.
>
> For example, lets say you want to display ≤ where ever the scala source code
> contains '<' followed by '=', ie. <=.
>
> (defconst scala-less-equal-char (decode-char 'ucs #x2264))
>
> (defconst scala-key-words
> '("\\(<=\\)"
> 1
>
> (progn (compose-region (match-beginning 1)
> (match-end 1)
> scala-less-equal-char)
> nil)))
>
> (font-lock-add-keywords nil scala-key-words)
>
> One can do a number of interesting things. All 'var' keywords are in red,
> scala-dangerous-face.
>
> ⊤⊥ for Any and Unit.
> ¬ for 'not'
> ∧ ∨ for &&, ||
>
> Underneath the source file doesn't change an iota, its only in how it is
> displayed in the emacs editor, so the file compiles clean.
>
> Ray
>
> P.S. Unable to currently test the above, but its the right idea. I don't
> have access to my system at the moment.
>
> On Tue, Jun 9, 2009 at 5:59 PM, Alex Cruise <
alex@...> wrote:
>>
>> Ray Racine wrote:
>>>
>>> Interesting if some of Scala's reserved symbols were legally aliasable
>>> with their equivalent unicode character.
>>
>> Yes, that would be interesting indeed. :)
>>
>> def f(n: ⇒ Int) = for (x ← 1 to n) yield Map(x → ("*" * x))
>>
>> -0xe1a
>
>