If Ascii operators are definable, why not Unicode Symbols?

I'm sure I join many in being glad there's finally a powerful language tied tightly to a mainstream GUI/Database/Communication framework.

I haven't been sure where to post this, but here seems the best spot.

I need to use Unicode symbol characters either as operators or as function names. I'd like syntactic sugar, but I don't need it.

Guy Steele pointed out in Communications of the ACM that "*" was a forced choice when it was adopted from Ascii as multiply, but my software works in Unicode, so I'm not tethered to Ascii anymore.

!$%&*+-./<=>?,@^|~:

Part of localization includes local programmers. Why limit the set of operators that can be defined in F#? It isn't orthogonal to C#'s and F#'s acceptance of many Unicode IsLetter in identifiers.

Also, F# is likely to be used for symbolic manipulation of problems from logic, math, physicists, etc. It makes work much easier if there's a direct mapping into the language of the basic operators. (F# and C# accept many Unicode IsLetter? as well as IsDigit'? This is a request to allow Unicode IsSymbol? As operators with the precedence of, for example, *, or, since “+” is both a unary and binary operator, I could put up with the precedence of + and make up the difference with parenthesized groupings.

Consider the domain-specific needs of logicians, mathematicians, physicists, etc. I'd rather write a symbolic differentiator or integrator using math symbols than Ascii permutations of already-taken operators.

  • Logic: ∀ ∃ ⇒
  • Math: ∑ ∫ ∂
  • Group theory: ≤ ≥ ∈ ∉
  • Set Theory: ⊆ ⊇ ⊃ ∪ ∩
  • Tensors: ⊗
  • I've written many languages in other languages, but because F# is tightly .Net-integrated, this issue poses special challenges without language support:

    It's trivial to cobble up a translator that takes Unicode-operator F# source and maps it, line-by-line, to Ascii-operator F# source.

    But when debugging, how do I make sure the programmer still sees their untranslated source? And that they can see variable values.

    Operators and converts them is trivial. But how do I ensure the translation is what gets compiled, while the programmer sees their own source? If I map line-for-line correctly, how do I ensure they can still point at a variable and see its value?


    There is a math (Unicode) symbol extension for F# available in the Visual Studio Gallery.

    This allows you to define Unicode symbols, eg:

    let inline (~∑) xs = xs |> Seq.sum
    
    let total = ∑myList
    

    You may be interested in Project Fortress which is a new functional programming language that embraces the Unicode character set (among many other features). In particular, see the Mathematical Syntax in Fortress page which contains some sample code.


    有关此检查的有趣讨论:http://cs.hubfs.net/forums/thread/9690.aspx

    链接地址: http://www.djcxy.com/p/72808.html

    上一篇: Scala @运营商

    下一篇: 如果Ascii运算符是可定义的,为什么不使用Unicode符号?