0.3.4
V 0.3.4
30 Apr 2023
- vweb now supports live page reloading. The web app is instantly updated in the browser (no need to refresh the page) everytime a .v or a .html file is changed.
- vweb is now significantly faster and more stable under load, due to a new multithreaded worker pool, which is much more efficient at spreading the workload among all threads equally.
- Middleware support in vweb.
- vweb now supports controllers. It's now possible to have multiple app structs to better separate logic.
- vweb: overridable
.not_found()method for custom 404 pages. - A new pure WASM backend, based on binaryen, a WASM
builtinmodule, and a pure V WASM serialization library. - Lots of playground improvements: play.vlang.io, including a really cool feature: "Show generated C code".
v share file.vfor sharing code via the playground.- All ORM queries now return
. This allows to handle/propagate DB errors and simplifies working with ORM (one way). - Many ORM improvements: type checks for
limit/offset/order by/where; support of reference objects ininsert; struct fields can be used withlimit/offset;Connectioninterface. - ORM now supports the
likeoperator:users := sql db { select from User where name like 'Bob%' }. - A new
-d trace_ormoption to see all SQL queries generated and used by V ORM and-d trace_pg_errorto trace PG errors. - A new command line flag
-efor running short V programs on command line:v -e "println(2+5)"(works just like in Perl). v upsped up for when it hasn't been run for a long time (vc/ bootstrapping has been optimized).- Lots of new checks in the checker.
- Variable shadowing has been completely banned (previously variable names could conflict with module names).
- If guards now work with struct fields which are
Optionfunctions. Such fields can now also be assigned to other fields/variables. - net.ssl: types using ssl contexts can now be converted to strings via
.str()/printed viaprintln(). - v.reflection: type symbol info metadata has been added.
- cgen: do not generate unused interface functions.
- A new
[spawn_stack: 131072]fn attribute for controlling the max size of the stack of the spawned threads. - Final steps in making the Option type a first class type.
- Lots of documentation/readme improvements.
- Option receivers can no longer have methods.
nonecan now be cast to allOptiontypes, including aliases.- Enums can no longer be initialized like structs.
- Builtin methods
first/last/repeatcan now be used in custom user types (previously they only worked in builtin arrays). v initno longer overwrites existingsrc/main.v.- Anonymous fn params can no longer be shadowed.
- Channel pop now works with an
orblock:ch := <-self.item or { return none } - Option references are now supported:
?&Type. - C++20 standard support in the C++ backend.
v selfnow uses a faster tcc backend on macOS/Apple Silicon, just like on Windows/Linux.os.hostname()andos.loginname()now returnResult.- The "Is V still fast?" web page has been sped up by splitting the results table into multiple years.
- Allow
foo := Foo{}, whenFoohas an Option field, that is a struct, that has a[required]tag on its fields (#17516). - Comptime reflection now supports interface fields.
- comptime:
$option(for f in Foo.fields { $if f.typ is $option { ...). - comptime: compile-time enum evaluation with `$for
- comptime: all types are now lowercase (
$int, $enum, $optionetc).
item in MyEnum.fields { dump(item.value) dump(item.name) }`. - Arrays of
Options are now allowed. ithas been renamed toindexin array inits.datatypes.LinkedList[map]now works correctly.cryptoandmathmodules have been updated to useResultinstead ofOption.[required]fields are now checked for embedded structs.readlinemodule now works much better on macOS: key navigation, history, etc (now on par with Linux).- Basic QNX support.
- A new
-ldflagsoption, in addition to-cflags. Works just like LDFLAGS in C. urllib.Values.get()now returns an Option.strconv:v_printf()was made private,v_sprintf()was deprecated. String interpolation should be used instead.- Fixed a bug with closures with fixed array variables.
- Generic struct inits no longer need explicit types provided:
struct Foo[T, U] { a T; b U } foo := Foo{a:2, b:'x'} os.Processnow has acreate_no_windowoption (Windows only).os.Processnow has aset_work_folder()method to set the initial working folder of the new child process.json: enums are serialized as strings by default,[json_as_number]attribute can be used for the old behavior.net.http: mime types have been updated to include all official types.gg:create_image()now returns!Imageinstead ofImage, 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.
- A new
termiosmodule. - Lots of fixes and new features in the native backend, including making codegen logic platform-independent.
strconv.atoioptimizations.println()now supports arrays with recursive references.- Multipart form parsing fixes in vweb.
- A database pool in vweb.
- termux: support for cross-compilation from termux to other platforms.
- GitHub Copilot summaries in PRs.
- unsafe: dereferencing nil references is no longer allowed.
- os: fixed a memleak in
getline(). - Mixing multi-return results with other types in return statements is no longer allowed (this simplifies the code).
- Assigning anonymous structs to named structs is no longer allowed.