Skip to content

Instantly share code, notes, and snippets.

@bqqbarbhg
Last active December 29, 2020 02:11
Show Gist options
  • Select an option

  • Save bqqbarbhg/07c2fc6dd3269fdcdaf14af41fb7df50 to your computer and use it in GitHub Desktop.

Select an option

Save bqqbarbhg/07c2fc6dd3269fdcdaf14af41fb7df50 to your computer and use it in GitHub Desktop.
Language ideas

Use single quotes for "untypeable" identifiers

  • Allows using keywords and operators as names
  • Backtick could be an option
    • Hard to type on ISO layout
    • Breaks markdown embedding
  • Escapes?
    • Probably \ with '\\\'' -> \'
  • Could be used as Ruby-like symbols?
def 'def'() {
    print("Why would you ever do this")
}

def '*'(a: Vec2, b: Float): Vec2 {
    return { x: a.x*b, y: a.y*b }
}

Define operators as quote-identifier'd symbols

  • Define built-in operators as quoted functions we can pass forward
// This would be a builtin
def '*'(a: Float, b: Float): Float {
    return a * b;
}

// Alright this could get very messy from overload resolution standpoint
let product = numbers.reduce('*', 1.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment