V 0.4 is out! #18730
Pinned
medvednikov
started this conversation in
Announcements
V 0.4 is out!
#18730
Replies: 6 comments
-
Exciting news 👍 👍 👍 ! |
Beta Was this translation helpful? Give feedback.
0 replies
-
awesome, ready to use for prodution! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Awesome 😎🔥 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Awesome 🔥🔥🔥 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
V 0.4 is out!
2160 commits pushed to master, 1205 bugs closed since V 0.3.
4 165 files changed, 329 174 insertions(+), 42 434 deletions(-)
The changelog is huge! It has 370 items:
V 0.4
1 July 2023
Improvements in the language
-use-coroutines
andcoroutines.sleep()
instead oftime.sleep()
. They work with IO and net, but not with GCfor now.
spawn
now spawns system threads,go
spawns coroutines.Foo.new()
to replace factory functions likenew_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 toindex
in array inits.go foo()
has been replaced withspawn foo()
(launches an OS thread,go
will be used forupcoming 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 insideunsafe
.const y = term.yellow
, thenprintln(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 ofreturn 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 insideunsafe
. Replacesvoidptr(0)
.src/
directory. This allows making V repos much cleaner.assert condition, extra_message
, where theextra_message
will be evaluated and shown if the assertion fails..c.v
files.Breaking changes
byte
deprecated in favor ofu8
(byte
is automatically converted tou8
by vfmt).json
: enums are serialized as strings by default,[json_as_number]
attribute can be used forthe old behavior.
module names).
[]
is now used for generics instead of<>
.or {}
block outsideunsafe
.Checker improvements/fixes
Result
type aliases (type Foo = !Bar
) andResult
in maps (map[key]!Type
).a << none
, wherea
is[]?&int
.else
branches in a match.C.stat
,C.sigaction
, etc.array.delete
calls._ = <- quit
.enum val
andconst
as fixed array size.Option
functions.Such fields can now also be assigned to other fields/variables.
none
can now be cast to allOption
types, including aliases.?&Type
.Option
s are now allowed.foo := Foo{}
, whenFoo
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 onlyworked in builtin arrays).
cannot use literal signed integer as u8
.if
is now checked.shared
types.Standard library
[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.mark phase for non escaping maps/arrays, used in hot loops.
for
loop for copying data.termios
module.net.ssl
: types using ssl contexts can now be converted to strings via.str()
/printedvia
println()
.v.reflection
: added type symbol info metadata.crypto
andmath
modules have been updated to useResult
instead ofOption
.datatypes.LinkedList[map]
now works correctly.urllib.Values.get()
now returns an Option.strconv
:v_printf()
was made private,v_sprintf()
was deprecated. String interpolationshould be used instead.
net.http
: mime types have been updated to include all official types.gg
:create_image()
now returns!Image
instead ofImage
, allowing to handle errors.sokol
: errors during image creation no longer result in a panic, but can be handled by theprogrammer.
sokol
: macOS apps can now be quit using Cmd+Q.os.hostname()
andos.loginname()
now returnResult
.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 withLinux).
os
: fixed a memleak ingetline()
.os.Process
now has acreate_no_window
option (Windows only).os.Process
now has aset_work_folder()
method to set the initial working folder of the newchild process.
math.vec
module for generic vector math including 2D, 3D, and 4D vector operations.Optional
have been replaced withOption
.gg.Context
pipeline has more effects, including theadditive
effect.os
: refactorerr == IError(os.Eof{})
toerr 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
andmath.mathutil
have been removed.time.format_rfc3339()
.encoding.html.escape()
.hash
andencoding.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 nolonger have an OpenSSL dependency. OpenSSL can still be enabled via
-d use_openssl
.v install msgpack
)datatypes
.datatypes.LinkedList<T>
, forward and backward iterators fordatatypes.DoublyLinkedList<T>
.maps
module, similar to existingarrays
. It has genericfilter
,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 optionalmode
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 toResult
.string.replace_char()
,math.round_sig()
.math.big
.Web
[vweb_global]
andshared
.get_tag()
methods to find first tag occurrence.The web app is instantly updated in the browser (no need to refresh the page)
every time a .v or a .html file is changed.
pool, which is much more efficient at spreading the workload among all threads equally.
It's now possible to have multiple app structs to better separate logic.
.not_found()
method for custom 404 pages in vweb.vweb.csrf
module.net.urllib
ipv6 support.net.Http.Response.text
renamed tobody
.net.websocket
timeout is now configurable.ORM
[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 objectsin
insert
; struct fields can be used withlimit/offset
;Connection
interface.like
operator:-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.Database drivers
sqlite
module;sqlite.get_affected_rows_count()
.pg
compatibility with older PostgreSQL versions before 2014.sqlite
,pg
,mysql
have been moved todb.sqlite
,db.pg
,db.mysql
.Native backend
V interpreter
C backend
[N]chan
(fixed arrays of channels).the number of cores). Experimental and hidden behind a -parallel-cc flag, soon to be the default.
#preinclude
for low level C interop.WASM backend
builtin
module, and a pure V WASM serialization library.Comptime
$res
comptime function to get returned value in defer block (v: add $res compile time function to get returned value in defer block #18382).$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
.Compiler CLI
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 beenoptimized).
v init
no longer overwrites existingsrc/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.OS support
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.)Tooling
v ls --install -p D:\path\vls.exe
to install a local vls executable.feature: "Show generated C code".
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.code sharing by link, more convenient keyboard control, reusability for potential embedding:
https://play.vlang.io.
-trace-calls
.is made via
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.Beta Was this translation helpful? Give feedback.
All reactions