V 0.4 is out! #18730
Pinned
medvednikov
started this conversation in
Announcements
V 0.4 is out!
#18730
Replies: 6 comments
-
|
🎉🎉 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
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
-
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
Uh oh!
There was an error while loading. Please reload this page.
-
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-coroutinesandcoroutines.sleep()instead oftime.sleep(). They work with IO and net, but not with GCfor now.
spawnnow spawns system threads,gospawns 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.orblock:ch := <-self.item or { return none }ithas been renamed toindexin array inits.go foo()has been replaced withspawn foo()(launches an OS thread,gowill be used forupcoming coroutines instead).
// vfmt offand// vfmt onfor 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.nonefixes: 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-limitin favour of the documented-message-limitoption.len:is required when using default values for the array.[]u8arrays creation.type Alias = map[string]Alias).return MyCustomErr{}instead ofreturn IError(MyCustomErr)..0conditionally appended to them to improve clarity.enum Xyz as u64 {.unsafe{}.sync.Pool.-skip-unusedfixes, 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_messagewill be evaluated and shown if the assertion fails..c.vfiles.Breaking changes
bytedeprecated in favor ofu8(byteis automatically converted tou8by 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
Resulttype aliases (type Foo = !Bar) andResultin maps (map[key]!Type).a << none, whereais[]?&int.elsebranches in a match.C.stat,C.sigaction, etc.array.deletecalls._ = <- quit.enum valandconstas fixed array size.Optionfunctions.Such fields can now also be assigned to other fields/variables.
nonecan now be cast to allOptiontypes, including aliases.?&Type.Options are now allowed.foo := Foo{}, whenFoohas 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/repeatcan now be used in custom user types (previously they onlyworked in builtin arrays).
cannot use literal signed integer as u8.ifis now checked.sharedtypes.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_uint8function for resizing images in memory.mark phase for non escaping maps/arrays, used in hot loops.
forloop for copying data.termiosmodule.net.ssl: types using ssl contexts can now be converted to strings via.str()/printedvia
println().v.reflection: added type symbol info metadata.cryptoandmathmodules have been updated to useResultinstead 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!Imageinstead 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.atoioptimizations.println()now supports arrays with recursive references.termux: support for cross-compilation from termux to other platforms.readlinemodule now works much better on macOS: key navigation, history, etc (now on par withLinux).
os: fixed a memleak ingetline().os.Processnow has acreate_no_windowoption (Windows only).os.Processnow has aset_work_folder()method to set the initial working folder of the newchild process.
math.vecmodule for generic vector math including 2D, 3D, and 4D vector operations.Optionalhave been replaced withOption.gg.Contextpipeline has more effects, including theadditiveeffect.os: refactorerr == IError(os.Eof{})toerr is os.Eof.x.json2, the pure V json encoder, soon to become official.v.reflectionmodule 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.cryptomodules.math.utilandmath.mathutilhave been removed.time.format_rfc3339().encoding.html.escape().hashandencoding.base32modules have been documented.crypto.pemmodule.map.reserve()method.net.sslhas 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>.mapsmodule, similar to existingarrays. It has genericfilter,flatten,invert,to_map,to_array,from_arrayfunctions.
utf8.is_number(),utf8.is_space()functions.encoding.base32module.gg.TouchPointto differentiate between different types of touch input.str.int()conversion speedup (without -prod).os.mkdir()now has an optionalmodeparameter.encoding.csvis now generic, supports bools, accepts a custom delimiter, and is compatible with io.Reader/io.Writer.datatypesmodule now uses operator overloading.datatypestypes can be converted to V arrays.smtpimprovements 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).iohas 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.csrfmodule.net.urllibipv6 support.net.Http.Response.textrenamed tobody.net.websockettimeout is now configurable.ORM
[skip]and[sql:'-']fixed..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;Connectioninterface.likeoperator:-d trace_ormoption to see all SQL queries generated and used by V ORM and-d trace_pg_errorto trace PG errors.where.select from User where (name == 'Sam' && is_customer == true) || id == 1.Result, so the errors can be handled.Database drivers
sqlitemodule;sqlite.get_affected_rows_count().pgcompatibility with older PostgreSQL versions before 2014.sqlite,pg,mysqlhave 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.
#preincludefor low level C interop.WASM backend
builtinmodule, and a pure V WASM serialization library.Comptime
$rescomptime function to get returned value in defer block (v: add $res compile time function to get returned value in defer block #18382).$optionas 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 inworks with alias types.field.is_<field>,field.is_alias,field.is_enum.Compiler CLI
v share file.vfor sharing code via the playground.v upspeed up for when it hasn't been run for a long time (vc/ bootstrapping has beenoptimized).
v initno longer overwrites existingsrc/main.v.v selfnow uses a faster TCC backend on macOS (Intel/Apple Silicon), just like on Windows/Linux.-efor running short V programs on command line:v -e "println(2+5)"(works just like in Perl).
-ldflagsoption, in addition to-cflags. Works just like LDFLAGS in C.OS support
makesupport for OpenBSD.v install pcreon 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.cdistributed on non-Windows systems. (v_windows.cis used on Windows.)Tooling
v ls --install -p D:\path\vls.exeto install a local vls executable.feature: "Show generated C code".
make.bat&v upimprovements on Windows.v -test-runner teamcity foo_test.v.v -show-timings.v new <name> webfor 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
vgretand is compared to the expected result.v lstool for installing, for updating, and for launching VLS (V Language Server).v docnow has syntax highlighting.Beta Was this translation helpful? Give feedback.
All reactions