top | item 22786934

(no title)

unlinked_dll | 5 years ago

Rust uses the "turbo fish" to get around this. Your example wouldn't compile unless a and b where valid variable names.

    a::<b> (c) 
Is how you instantiate a generic. It's not that ugly. Bigger problem is value type generics/const generics where you want to do some logic like

     a<b > c>

discuss

order

cwzwarich|5 years ago

> Bigger problem is value type generics/const generics

How does Rust solve the ambiguities with const generics?

monocasa|5 years ago

The ambiguous const generics have to be surrounded by { }:

  fn function<T, { ambigous const generic expression }>(arg1: T) -> T {

unlinked_dll|5 years ago

I believe the current proposal (partially supported on nightly) is to require expressions in generic arguments to be enclosed in {}

chrismorgan|5 years ago

The expression must be wrapped in curly braces: Type<{ expression }>