I found a interesting GLSL code on Twitter: 
[https://twitter.com/valentin_galea/status/1188147946468134913](https://twitter.com/valentin_galea/status/1188147946468134913)

I tried to write a code in similar way in Nim, but no success.
    
    
    proc foo: float =
      1.0 / (1.0 + 2.0 + 3.0)
    
    proc foo2: float =
      # compile error
      (1.0
      /
      (1.0 + 2.0 + 3.0))
    
    
    Run
    
    
    template `--------------------`(x, y: untyped): untyped = x / y
    
    proc foo3: float =
      1.0 -------------------- (1.0 + 2.0 + 3.0)
    
    proc foo4: float =
      # compile error
      (      1.0
      --------------------
      (1.0 + 2.0 + 3.0))
    
    
    Run

Is it impossible to write code like this in Nim?

Reply via email to