V: error: unexpected `name`, expecting `if` when using $vweb

Created on 13 Apr 2020  路  5Comments  路  Source: vlang/v

V version: V 0.1.26 83289d7.a9a8f8c
OS: Linux (NixOS)

What did you do?

Build with following code included...

$vweb.html()

What did you expect to see?

Clean build.

What did you see instead?

v -o goalmonitor -debug main.v
main.v:101:3: error: unexpected `name`, expecting `if`
   99|     members := model.all_members(app.db)
  100|
  101|     $vweb.html()
            ~~~~
  102| }
  103|

This same code was working prior to the v2 compiler merge, all other problems have gone away since, but this one remains.

P.S. The new compiler errors are looking great! :+1:

Bug

All 5 comments

Yes it's one of the remaining features. Working on it.

will it be compiler magic?

will it be compiler magic?

For everyone else not in the loop, it's a language feature as answered by Alex in Discord:
Screenshot From Discord

Transcribed:

danieldaeschle: Will $fns be compiler magic or a language feature? If it's compilermagic for some some functions it's unfair that vweb supports it and other frameworks can't.
Alex M: language feature

I got same error here but in different function:
29 | fn (app &App) index() { 30 | articles := app.find_all_articles() 31 | $vweb.html() | ~~~~ 32 | } 33 |

V Version: 0.1.27 649a014.0fcae84
OS: Windows 10 Home

Fixed in V 0.1.29 4774c89.

Was this page helpful?
0 / 5 - 0 ratings