Comments (3)
This works
type MyArray = [4]int
a := MyArray([12, 45, 78, 78]!)
println(a)
from v.
The error message is incorrect, but it shouldn't work.
_ := MyArray{}
would be trying to create a 0 length fixed array, which makes no sense at all. Similar to just declaring
_ = []!
V doesn't give a good error message in any case where []!
is used. For my example, it just says "error: expression evaluated but not used".
If you try println([]!)
it says "error: invalid expression: unexpected token )
".
Basically, []!
is invalid, as you can't have a 0 length fixed array.
from v.
V doesn't give a good error message in any case where []! is used. For my example, it just says "error: expression evaluated but not used".
But it is not an alias to empty array. It is an alias to [10]int
.
from v.
Related Issues (20)
- Windows: coroutines should display a message that they don't work on Windows, instead of complaining about photonwrapper.so not found HOT 1
- error using `@[flag]` in `vlib/flag/flag.v`
- cgen error, when example is compiled with -autofree HOT 1
- [builder error] match + &
- Unhandled Exception 0xC0000005 HOT 1
- i tried the compile simple sdl window file from sdl example, it shows this error HOT 3
- cgen error: '__v_error' undeclared HOT 1
- anonymous struct embedding lacks checks
- How to obtain generic results using the following function? HOT 2
- string interpolation does not correctly reports pointer when used with maps
- carray_to_varray inside unsafe block warns about requiring an unsafe block
- Bug while practicing copying the concurrency examples
- C Error building lsv with -skip-unused
- cgen error in auto generated str() method of an enum with duplicate enum keys
- cgen error when trying to use enum key prematurely
- reverse bytes function HOT 3
- C error is constant used as enum value before it is defined
- When the length of the array exceeds 1073741824, it will cause the current thread to be in a blocked state HOT 10
- assert for no errors HOT 1
- Calling $veb.html() generates cgen error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v.