Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method call syntax with templates #1258

Closed
def- opened this issue Jun 9, 2014 · 0 comments
Closed

Method call syntax with templates #1258

def- opened this issue Jun 9, 2014 · 0 comments

Comments

@def-
Copy link
Member

def- commented Jun 9, 2014

I don't know if method call syntax should work with templates, but right now the error is not very clear:

type Length = distinct float
const meter = Length(1.0)

template metricPrefix(unit: expr, prefix: expr, factor: expr): stmt =
  const `prefix unit`* {.inject.} = factor

# Doesn't work
meter.metricPrefix(milli, 1e-3)
# Works
#metricPrefix(meter, milli, 1e-3)
minimal.nim(8, 5) Info: instantiation from here
minimal.nim(5, 8) Error: identifier expected, but found '`milli 1.0000000000000000e+00`'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants