Releases: vlang/v
Releases · vlang/v
weekly.2024.47
releases: weekly.2024.47
weekly.2024.46
releases: weekly.2024.46
weekly.2024.45
releases: weekly.2024.45
weekly.2024.44
releases: weekly.2024.44
weekly.2024.43
releases: weekly.2024.43
weekly.2024.42
releases: weekly.2024.42
weekly.2024.41
releases: weekly.2024.41
0.4.8
V 0.4.8
28 Sep 2024
Improvements in the language
- A new
implements
keyword for explicit interface implementation - Allow multi return as fn argument (#21991)
- Define a default sumtype value (based on the first variant type) (#22039)
- Remove the obsolete .code and .msg fields of IError (#22066)
- Fix generic lambda type binding and resolution (#22083)
- Comptime support for traversing the method parameters with
$for param in method.params {
(#22229) - Show missing variants in the sum type error
- A much better and detailed unmatched fn arg error
- Add support for
@BUILD_DATE
,@BUILD_TIME
and@BUILD_TIMESTAMP
, all using v.util.get_build_time(), and overridable through SOURCE_DATE_EPOCH (#22213)
Breaking changes
- Deprecate
x.vweb
andvweb
in favor ofveb
, a faster, easier, and more stable framework.
Checker improvements/fixes
- Disallow static fn call when receiver type is unknown (#21970)
- Fix sumtype checking for voidptr variant (#21955)
- Check comptime veb.html('index.html') (#21961)
- Check if a parent generic struct has concrete types or not (#21962)
- Add support for static methods in
@FN
and@METHOD
(#21990) - Add a deprecation warning for
const ()
groups (an error after 2025-01-01) (#22019) - Improve
-d trace_checker
and error diagnostic information on compiler panics - Add error when initializing sumtype with struct as first type (#22067)
- Add infix checks for nil (#22045)
- Fix map generic fn arg passing (#22071)
- Disallow using a preexisting const name in a for loop, as either a key or value ident (#22108)
- Fix generic lambda type binding resolution (fix #22109) (#22115)
- Fix array alias (#22175)
- Restrict multiple union fields initialised at once with a nicer checker error, instead of producing an enigmatic error at cgen time (#22196)
- Fix compilation of vlib/v/slow_tests/assembly/asm_test.amd64.v (regression after dfc0c91)
- Add missing check for ref passing to non-ref (#22194)
- Check struct implements non interface type (fix #22200) (#22218)
- Suggest using the
@[_allow_multiple_values]
attribute, when declaring enums that have duplicate values (#22224) - Check for duplicate interface names in the
implements
parts of struct declarations (#22230) - Fix missing struct field type checking for type mismatch (ref vs non-ref in
mt sync.Mutex = sync.new_mutex()
) (fix #18088) (#21949) - Fix fntype var marked as auto heap (#22290)
- Check array.delete() argument mismatch (#22307)
- Add missing check for duplicated items on in expr (fix #22305) (#22308)
- Disallow infix expr on left side of assign (#22322)
- Fix array fixed return type for interface methods (#22320)
- Check arguments mismatch of array.sorted_with_compare() (fix #22327) (#22328)
- Add an error for returning an
any
value in pure V code (prevents invalid cgen) (fix #12623) (#22334) - Cleanup the checking of array method calls (#22338)
- Fix voidptr type checking (#21923)
Parser improvements
- Fix lots of parser panics, discovered through fuzzing with radamsa
- Improve the error for keyword
lock
, used as a variable name (#21937) - Improve the error message position for invalid array attr keys (#21944)
- Fix const field str() (#21998)
- Update
@include
in templates, to work with relative paths & prevent recursive calls (#21943) - Check fn call args without comma between them (related #22021) (#22075)
- parser,scanner,ast: make the scanner and parser more robust, by implementing more limits (preventing panics, discovered by fuzzing)
- Protect against too deep recursion in Expr.pos() calls
- Check too many layers embedded generic type (fix #22089) (#22091)
- Cache ident lookups for consts in ast Expr str (#22101)
- Improve Type and TypeFlag related operations (#22107)
- Fix parsing map value inside or expr (fix #12164) (#22180)
- Fix const field str() (#22192)
- Fix
.${var}
used in a template, compiled by$tmpl()
(fix #22231) (#22270) - Check enum method duplicated (fix #20924) (#22294)
Compiler internals
- scanner: guard against scanner panic, discovered by fuzzing in PR#22016
- v.builder: show the thirdparty object compilation commands too, when using
-showcc
(when the cache is empty) - builder: allow for
v -dump-defines - -check cmd/v
, which is faster, because it can skip code generation - Reduce allocations for the most common cases (#22142)
- transformer: add support for instrumenting the V compiler with
-d trace_transformer
Standard library
- encoding.base58: fix notice for slice creation (#21935)
- gg: reset ctx.mouse_d? and ctx.scroll_? at the end of each frame (fix #21945) (#21946)
- builtin: v_segmentation_fault_handler signal_number i32
- builtin: fix 'aaaa'.split('aa') (fix #21936) (#21951)
- builtin: panic on trying to grow arrays with capacity bigger than 2^31, instead of overflowing a.cap (partial fix for #21918) (#21947)
- gg: add a note that Context.new_streaming_image has to be called after Sokol's setup
- gg: add more documentation comments for gg.Config (the parameters of gg.start and gg.new_context)
- regex: fix regex.split() (fix #16876) (#21953)
- json: increase test cases before enabling sumtype decode in all json libraries (#21958)
- gg: change the type of gg.DrawImageConfig.rotate from
int
tof32
- gg: deprecate gg.DrawImageConfig.rotate, in favor of gg.DrawImageConfig.rotation, improve the documentation comments (#21963)
- x.crypto.chacha20: make Cipher struct public (fix #21967) (#21968)
- tmpl: fix an extra newline in @for; builtin: some i64 fixes
- gg: add an optional size: parameter to the .draw_pixels and .draw_pixel methods (defaults to 1.0)
- sokol: update to match upstream at c0e0563 (#21971)
- Add support for
Any
indecode_struct
,encode_struct
andto_any
(#21972) - crypto.cipher: make Stream.xor_key_stream implementers require a mutable receiver (#21974)
- sokol.audio: fix
./v -cc clang-18 -gc none simple_bytebeat.v
(the audio depends on threads) - time:
d
,c
,dd
,ddd
,dddd
pattern support for parse_format() (#22003) - flag: add optional value description to string parameters (#22024)
- flag: add custom value descriptions for bool, int, and float flags too (#22032)
- flag: fix assigning to
@[tail]
field when no fields has been matched yet inflag.parse[T]()
(#22043) - crypto: add a crypto.pbkdf2 module (#22047)
- hash: add more methods to the hash.Hash interface, to match the ones in Go (#22001)
- arrays: simplify arrays.sum and arrays.reduce (#22076)
- x.json2: support @[skip] as well (#22077)
- builtin,thirdparty: fix compilation of libgc with
-cc msvc -gc boehm
(thanks to @Ekopalypse) - stbi: change Image.data from voidptr to &u8, to reduce casts (#21977)
- time: update parse_format comment description in parse.c.v (#22104)
- vlib: add an
arrays.parallel
module, containingparallel.run/3
andparallel.amap/3
implementations (#22090) - builtin: support
-d builtin_print_use_fprintf
, make the C fn declarations stricter (#22137) - builtin: fix map.clear() not resetting map's metas and keys blocks (fix #22139) (#22140)
- builtin: fix incomplete m.clear(), allowing the map to have a duplicated entry for its first key (fix #22143) (#22144)
- builtin: fix m.clear() having different observable behavior to
m = {}
, after multiple iterations of setting keys and clearing (fix #22145) (#22146) - builtin: fix bug in .clear() caused by sizeof(u32) being 4, not 2 (fix #22148)
- flag: add support for parsing
flag.FlagParser
style flags into_struct[T]
(#22152) - flag: fix parse_bool_value() (#22160)
- flag: correct bool logic, add test (#22162)
- flag: fix parsing
flag.FlagParser
style short flags into_struct[T]
(#22172) - gg: change the type of PenConfig.thickness to f32
- builtin: remove remaining references to v_calloc in function comments (#22179)
- builtin: remove string interpolation from panic/1, to be able to use tools like cbmc in more cases (#22182)
- flag: add a relaxed parsing mode, that turn flag match errors into
no_match
entries instead (#22191) - encoding.binary: add
u16
/u32
/u64
->[]u8
conversion functions (#22193) - crypto.sha1, crypto.sha256, crypto.sha3, crypto.sha512: improve performance for non prod builds, by tagging the block_generic functions with
@[direct_array_access]
- builtin: fix string.trim() (fix #13021) (#22205)
- crypto.bcrypt: reduce runtime cost for running bcrypt_test.v, by reducing the iteration count
- crypto.scrypt: add a new
scrypt
module to vlib/crypto (#22216) - sync.stdatomic: add OpenSUSE paths for libatomic
- crypto.scrypt: add missing comment of source for test vector (#22222)
- json: allow passing an anon struct as a decode type (#22228)
- flag: fix parse_bool_value() with different order short args (fix #22176) (#22242)
- builtin: drop C in int.v (#22245)
- strconv: fix format_fl()/format_es() (fix #13210) (#22244)
- json: fix decoding of structs with embeds (#22264)
- crypto.rand: add support for convenient generation of a random big integer in the interval
[0, n)
(#22266) - json: fix json encode/decode with embed support (#22277)
- io: add a BufferedWriter and supporting methods (#22265)
- vlib: add a go like
x.benchmark
module, that estimates automatically how many iterations are needed, to get a statistically significant result (#22215) - math: document q_rsqrt
- io: make buffered_writer_test.v more robust
- builtin: enable GC lib on rv64 build (#22319)
- json: support null sum types in decode()
- crypto: ecdsa module (on top of openssl)
- bench: crypto/ecdsa.v
- math.big: fix
a + b
anda - b
, when the signs are different, add more test cases (#22330)
Web
- Check for using comptime $veb.html()/$vweb.html(), without importing veb or vweb (#21957)
- net: add net.Dialer and net.Connection interfaces, abstracting the different types of connections, already supp...
weekly.2024.39
releases: weekly.2024.39
weekly.2024.37
releases: weekly.2024.37