1 July 2023
-use-coroutines and
coroutines.sleep() instead of time.sleep(). They work with IO and net, but not with GC
for now.spawn now spawns system threads, go spawns coroutines.Foo.new() to replace factory functions like new_foo().if sum_type is Foo && !sum_type.is_info && get_name(sum_type.info.name) == 'foo' .fn f[T](x T, i int, f_ Fn[T]) T { .[spawn_stack: 131072] function attribute for controlling the max size of the stack
of the spawned threads.or block: ch := <-self.item or { return none }it has been renamed to index in array inits.go foo() has been replaced with spawn foo() (launches an OS thread, go will be used for
upcoming coroutines instead).// vfmt off and // vfmt on for turning off the formatting locally
for short snippets of code.
Useful for keeping your carefully arranged matrices intact.match x { const1...const2 {} }[live] is now supported in imported modules, not just the main module.all.children := { "abc": rect, "def": ui.rectangle()}.$embed_file() fixes, including variable args support.none fixes: no longer allowed to be used as a separate type, dump() support,
not allowed inside unsafe.const y = term.yellow, then println(y('abc')).typeof[T](), sizeof[T](), isreftype[T]() functions.-error-limit in favour of the documented -message-limit option.len: is required when using default values for the array.[]u8 arrays creation.type Alias = map[string]Alias).return MyCustomErr{} instead of return IError(MyCustomErr)..0 conditionally appended to them to improve clarity.enum Xyz as u64 {.unsafe{}.sync.Pool.-skip-unused fixes, soon to be made the default.nil. Only to be used inside unsafe. Replaces voidptr(0).src/ directory. This allows making V repos much cleaner.assert condition, extra_message, where the extra_message will be evaluated
and shown if the assertion fails..c.v files.byte deprecated in favor of u8 (byte is automatically converted to u8 by vfmt).json: enums are serialized as strings by default, [json_as_number] attribute can be used for
the old behavior.[] is now used for generics instead of <>.or {} block outside unsafe.Result type aliases (type Foo = !Bar) and Result in maps (map[key]!Type).a << none, where a is []?&int.else branches in a match.C.stat, C.sigaction, etc.array.delete calls._ = <- quit.enum val and const as fixed array size.Option functions.
Such fields can now also be assigned to other fields/variables.none can now be cast to all Option types, including aliases.?&Type.Options are now allowed.foo := Foo{}, when Foo has an Option field, that is a struct, that has a [required]
tag on its fields.[required] fields are now checked for embedded structs.first/last/repeat can now be used in custom user types (previously they only
worked in builtin arrays).struct Foo[T, U] {
a T
b U
}
foo := Foo{
a: 2
b: 'x'
}
println(foo)
a := unsafe { nil }
println(*a)
cannot use literal signed integer as u8.if is now checked.shared types.[json:'alias'] to change its string values.[json:'-'] and [sql:'-'],
in addition to [skip]. This allows having custom behavior for different serialization methods.mod_inverse.stbi.load().resize_uint8 function for resizing images in memory.for loop for copying data.termios module.net.ssl: types using ssl contexts can now be converted to strings via .str()/printed
via println().v.reflection: added type symbol info metadata.crypto and math modules have been updated to use Result instead of Option.datatypes.LinkedList[map] now works correctly.urllib.Values.get() now returns an Option.strconv: v_printf() was made private, v_sprintf() was deprecated. String interpolation
should be used instead.net.http: mime types have been updated to include all official types.gg: create_image() now returns !Image instead of Image, allowing to handle errors.sokol: errors during image creation no longer result in a panic, but can be handled by the
programmer.sokol: macOS apps can now be quit using Cmd+Q.os.hostname() and os.loginname() now return Result.strconv.atoi optimizations.println() now supports arrays with recursive references.termux: support for cross-compilation from termux to other platforms.readline module now works much better on macOS: key navigation, history, etc (now on par with
Linux).os: fixed a memleak in getline().os.Process now has a create_no_window option (Windows only).os.Process now has a set_work_folder() method to set the initial working folder of the new
child process.math.vec module for generic vector math including 2D, 3D, and 4D vector operations.Optional have been
replaced with Option.gg.Context pipeline has more effects, including the additive effect.os: refactor err == IError(os.Eof{}) to err is os.Eof.x.json2, the pure V json encoder, soon to become official.v.reflection module for runtime reflection.os.mv(), which now works consistently even across different
windows drives/mount points.string.trim_indent(), useful with multi line strings, that start/end with new lines
and indentation.crypto modules.math.util and math.mathutil have been removed.time.format_rfc3339().encoding.html.escape().hash and encoding.base32 modules have been documented.crypto.pem module.map.reserve() method.net.ssl has been migrated from a dynamically linked OpenSSL to a statically linked Mbed TLS.
This means that V binaries will no longer have an OpenSSL dependency.
OpenSSL can still be enabled via -d use_openssl.v install msgpack)datatypes.datatypes.LinkedList<T>, forward and backward iterators
for datatypes.DoublyLinkedList<T>.maps module, similar to existing arrays. It has generic filter, flatten,
invert, to_map, to_array, from_array functions.utf8.is_number(), utf8.is_space() functions.encoding.base32 module.gg.TouchPoint to differentiate between different types of touch input.str.int() conversion speedup (without -prod).os.mkdir() now has an optional mode parameter.encoding.csv is now generic, supports bools, accepts a custom delimiter,
and is compatible with io.Reader/io.Writer.datatypes module now uses operator overloading.datatypes types can be converted to V arrays.smtp improvements including multiple recipients and base64/utf8 support.arrays.carray_to_varray<T>() for converting C arrays to V arrays.strconv.v_sprintf() has been deprecated in favor of string interpolation.[toml:...] attributes, just like the JSON module.os.walk() is no longer recursive (still works the same).io has been migrated to Result.string.replace_char(), math.round_sig().math.big.[vweb_global] and shared.get_tag() methods to find first tag occurrence..not_found() method for custom 404 pages in vweb.vweb.csrf module.net.urllib ipv6 support.net.Http.Response.text renamed to body.net.websocket timeout is now configurable.[skip] and [sql:'-'] fixed.![] (Result of an array).
This allows handling/propagating DB errors and simplifies working with ORM (one way).limit/offset/order by/where; support of reference objects
in insert; struct fields can be used with limit/offset; Connection interface.like operator:users := sql db {
select from User where name like 'Bob%'
}
-d trace_orm option to see all SQL queries generated and used by V ORM and
-d trace_pg_error to trace PG errors.where.select from User where (name == 'Sam' && is_customer == true) || id == 1.Result, so the errors can be handled.sqlite module; sqlite.get_affected_rows_count().pg compatibility with older PostgreSQL versions before 2014.sqlite, pg, mysql have been moved to db.sqlite, db.pg, db.mysql.[N]chan (fixed arrays of channels).#preinclude for low level C interop.builtin module, and a pure V WASM
serialization library.$res comptime function to get returned value in defer block (#18382).$for item in MyEnum.fields {
println(item.value)
println(item.name)
}
$option as a compile-time reflection type representing an any Option type.$int, $enum, $option, etc).$if x is Type {;
$if T in [$Array, $Struct, $Alias, $Function] {.$for in works with alias types.field.is_<field>, field.is_alias, field.is_enum.v share file.v for sharing code via the playground.v up speed up for when it hasn't been run for a long time (vc/ bootstrapping has been
optimized).v init no longer overwrites existing src/main.v.v self now uses a faster TCC backend on macOS (Intel/Apple Silicon), just like on Windows/Linux.-e for running short V programs on command line: v -e "println(2+5)" (
works just like in Perl).-ldflags option, in addition to -cflags. Works just like LDFLAGS in C.make support for OpenBSD.v install pcre on Windows
(it now bundles its own .c files, so it compiles cleanly, even if the platform does not have
another pcre package installed).[console] attribute in Windows GUI apps.$if termux {, more predictable logging on Android.v.c distributed on non-Windows systems.
(v_windows.c is used on Windows.)v ls --install -p D:\path\vls.exe to install a local vls executable.make.bat & v up improvements on Windows.v -test-runner teamcity foo_test.v.v -show-timings.v new <name> web for quickly scaffolding new web projects.-trace-calls.vgret and is compared to the expected result.v ls tool for installing, for updating, and for launching VLS (V Language Server).v doc now has syntax highlighting.