V: about import and const,something strange

Created on 23 Apr 2019  路  4Comments  路  Source: vlang/v

hi,I try the code:
import os
import my_module
---above code is compiled
import (
os
my_module
)
---with (),get an error:bad import format

but const is different:
const PI=3.14
---without(),get an error:expected ( but got PI
const (
A=1
B=2
)
---with () code is compiled

Most helpful comment

Yes.

I don't like having 2 different ways to do imports, so most likely this will be handled by vfmt. If there's only one import, then it's converted to import module, otherwise it's converted to

import (
  a
  b
  c
)

All 4 comments

import (
os
my_module
)

is incorrect syntax at the moment, it shouldn't compile

Will it, in the future?

Yes.

I don't like having 2 different ways to do imports, so most likely this will be handled by vfmt. If there's only one import, then it's converted to import module, otherwise it's converted to

import (
  a
  b
  c
)

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

penguindark picture penguindark  路  3Comments

arg2das picture arg2das  路  3Comments

oleg-kachan picture oleg-kachan  路  3Comments

choleraehyq picture choleraehyq  路  3Comments

radare picture radare  路  3Comments