Releases: vlang/v
Releases · vlang/v
0.4.2
V 0.4.2
30 September 2023
Improvements in the language
- Short lambda expressions like
a.sorted(|x,y| x > y)
(#19390) - Support
-os plan9
,$if plan9 {
, and_plan9.c.v
(stage 1 for plan9) (#19389) - fmt: simplify the processing logic for removing inline comments (#19297)
- Align the custom values of the enum fields (#19331)
- Do not warn/error for
import flag as _
- Keep anon struct decl fields in interfaces (#19461)
- Support -N, turning all notices into errors, to ease the process of finding places that may need attention/correction
Breaking changes
- Remove inline comments (#19263)
Checker improvements/fixes
- Disallow module name duplicates in local names (#18118)
- Check enum fields with duplicate value (fix #19309) (#19310)
- Disallow alias ptr cast of a map value (#19336)
- Require
else
branch in[flag]
enum match (#19375) - Disallow assigning pointer values to option struct fields (#19380)
- Fix generic comparison for conditional assignment (#19401)
- Allow using ! and ~ on aliased bool and integral types (#19403)
- Warn -> error for uninitialized ref fields
- Parser, checker: allow lambdas anywhere anonymous functions are expected (#19436)
- Allow for
each(a, |x| println(x))
, i.e. using lambda expressions, when expectingfn (x int)
- Check fixed array init with default expression (#19472)
- Allow for
const source = $embed_file(@FILE).to_string()
- Fix C.type in imported modules
Parser improvements
- parser: fix fixed array with eval const size (#19269)
- parser: disallow using
sql
as name (#19298) - parser: fix
;
support formodule x;
- parser: fix fixed array of option values (
_ := [10]?int{}
) (#19392) - parser: fix assigning with in another module sumtypes 2 (#19415)
- v.ast: improve Stmt.str(), showing more details about ast.Block, ast.DeferStmt, ast.ForInStmt, ast.GlobalDecl
Compiler internals
- pref: support
-fast-math
, passing either -ffast-math or /fp:fast (for msvc) to the C backend, and$if fast_math {
to detect it at comptime - parser, transformer: fix transformer.infix_expr() and cleanup parse_types.v (related #19269) (#19276)
- pref,builder: support -use-os-system-to-run to workaround segfaults using not fully updated xcode command line tools
- v.builder: fix compiling code, that imports modules from both
src/modules
andmodules
(#19437) - os, v.builder: show more details, when a program ran by
v run file.v
, exits by a signal (fix #19412) (#19471)
Standard library
- math: speedup the pure V math.pow implementation for non-fractional powers (#19270)
- math: add more C. fn overrides, for the default C backend (speed up examples/path_tracing.v) (#19271)
- time: add
MMM
support for parse_format() (#19284) - os: include sys/sysctl.h on FreeBSD to avoid implicit definition of sysctl function (#19293)
- crypto.md5: change the Digest.write return type, from
?int
to!int
(#19311) - v.help: use os.executable() instead of
@VEXE
as an anchor, sov help
will work more robustly. - toml: fix custom
to_toml
for complex structs (#19338) - all: support
;
statements, allowing for oneliners like./v -e 'import os; println( os.ls(os.args[1])!.sorted(a > b) )' vlib/math
(#19345) - vlib: add net.http.file, allowing for
v -e "import net.http.file; file.serve()"
(#19348) - vlib: remove functions and fields, deprecated before 2023-03-20
- toml: fix toml encoding of complex types (#19408)
- arrays: add a partition function, that splits a given array, based on a criteria, passed as a callback fn (#19417)
- toml: add decoding for struct fields of type map[string]T (#19447)
- arrays: add arrays.each, arrays.each_indexed, and tests for them
- encoding.html: implement
unescape()
(#19267)
Web
- net.http: fix http.fetch(), without explicit method (default again to .get, not to .acl)
- net.http: default explicitly to Method.get for http.Request and http.FetchConfig too
- examples: add examples/fetch_ip.v, showing how to contact http://ifconfig.co/json and parse the result
- net.http: fix post error with https on windows (#19334)
- net.ssl: implement SSLConn.peer_addr() (#19333)
ORM
- orm: add
references
attribute to allow foreign key declarations on fields (#19349) - orm: support different foreign key types, not just an integer id (#19337)
- orm: add support for V enum struct fields (#19374)
- orm: quote table and field name in
[references]
(#19387)
Database drivers
- db.pg: allow postgres connection using service definitions (#19288)
Native backend
- native: make native tests pass on windows; refactor PE file generation (#19140)
- native: parse dll files to resolve extern symbols (#19433)
C backend
- Fix printing struct with thread field (#19320)
- Fix the logic around the definition of VNORETURN and VUNREACHABLE (less warnings on FreeBSD) (#19316)
- Add support for
-d trace_cgen_stmt
, document it in CONTRIBUTING.md - Fix printing smartcast interface variable (fix #18886) (#19372)
- Fix interface with multiple embedded fields (#19377)
- Fix channel of interface (fix #19382) (#19383)
- Fix fixed array of option type default (#19397)
- Fix interface with option field (#19434)
- Fix promoting an alias typed value, to a sumtype of the alias's base type (fix #19407) (#19423)
- Remove the special plan9 support code, treat it instead as a posix system in cheaders.v (#19445)
- Fix printing slice of fn call string (#19450)
- Fix
type VType = &C.CType
(#19452) - Fix array of fns index call with direct_array_access mode (#19460)
Tools
- bench: a new bench/ directory for language benchmarks
- ci: test the pure V math versions without .c.v overrides on the CI too (#19292)
- github: add automatically info about voting to all new issues (#19351)
- tools: add -E flag to
v test-parser
, that will show the partial source that caused the parser to fail with-no-builtin -check-syntax file.v
- ci: bring back gitly
- github: improve the voting message for issues (#19448)
- vcreate: update templates, add
lib
(#19444)
Operating System support
- builtin: use
libgc-threaded
on FreeBSD, to get the threaded version of libgc (#19294)
Examples
- examples: add more .obj files for 06_obj_viewer (#19406)
weekly.2023.39
releases: weekly.2023.39
weekly.2023.38
releases: weekly.2023.38
weekly.2023.37
releases: weekly.2023.37
0.4.1
V 0.4.1
3 September 2023
Improvements in the language
- Pure
array.sorted()
andarray.sorted_with_compare()
methods, that do not modify their receivers (#19251) - UB overflow has been removed
- Implement
Enum.from_string(name string)
for converting strings to enum values (#19156) - Disallow casting string to enum, suggest using Enum.from_string() instead (#19260)
- Use autocasting in complex conditions (#18839)
- Allow alias as fixed array on return (#18817)
- Do not allow uninitialized function pointers
- Fix compiling V programs with latest clang 16 on windows (clang 16 is stricter than clang 14) (#19095)
- Fix anonymous struct with default expr (#19257)
- Allow using consts as enum values (#19193)
@[attr]
syntax to replace[attr]
([]
is used for too many things). Most likely to be replaced with@attr()
in the future.- Allow
none
for not first values on map initialization (#18821) - Make all .trace() methods generic on the type of the passed expression
Breaking changes
arr[1..4]
now requiresunsafe
if the slice can modify the original immutable array.
Checker improvements/fixes
- Disallow assigning
nil
to struct fields (#18725) - Use autocasting in complex if conditions (#18753)
- Disallow invalid prefix on left side of assign stmt (#18750)
- Allow no return in compile_error else block (#18758)
- Fix interface param resolution (#18780)
- Add an error for
$tmpl
function type mismatches (#18826) - Disallow voidptr cast to struct (#18845)
- Fix type checker on auto deref var (#18842)
- Check generic sumtype declaration (fix #18741) (#18865)
- Fix closure with inherited sumtype variable (#18894)
- "v -line-info" for a quick run to fetch info about objects on one line
- Make sure vweb actions return vweb.Result
- Do not allow modifying immutable vars via arrays with refs
- Support @struct in static methods
- Fix generic struct field init recursively (related #19014) (#19025)
- Fix struct field fntype value call (#19067)
- Explicitly disallow creating type aliases of
none
, i.e.type Abc = none
(#19078) - Fix assigning an array slice (fix #19120) (#19137)
- Fix assigning array slice in struct init (#19150)
- Check enum static from_string arguments errors (#19163)
- Disallow taking the address of consts with int literal values (#19160)
- Check struct embed with wrong position (#19245)
- Optimize out needless string interpolations from the most common case in
Checker.expr_or_block_err
- Check error for or_expr inside infix expression (#19213)
- Disallow
thread
as var name (#19174) - Check error for sumtype in array (#19183)
- Disallow an empty
chan
type (#19167)
Parser improvements
- Change warn to error, for const names with upper letter (fix #18838) (#18840)
- Disallow declaring static functions as method receivers (#19007)
- Disallow having builtin type as type names for
enum
,sum type
andalias
(#19043) - Support
const x := 123
, to make extracting locals as constants less annoying while prototyping - Fix struct field fn type with default value (fix #19099) (#19106)
- Fix
for i++; i<10; i++ {
(fix #18445) (#19035) - Fix fn return alias of fixed array (#19116)
- Fix generic struct init (Stack[&Person]{}) (fix #19119) (#19122)
Compiler internals
- pref: make -autofree work without -gc none
- builder,pref: allow thirdparty objects compilation with CPP compiler (#19124)
- scanner: fix string interpolation with nested string interpolation in inner quotes p. 3 (#19121)
- scanner: error early on an unsupported escape sequence in a string, like
\_
(fix #19131) (#19134) - v.token: add inline next_to() and cleanup related calls (#19226)
Standard library
- eventbus: add generic support for event name (#18805)
- readline: add support for ctlr+w and ctrl+u shortcuts (#18921)
- strconv.atoi: fix string.int() returning numbers for non number characters (fix #18875) (#18925)
- builtin: reduce the number of array allocations for consts in all V programs (#18889)
- builtin: move array.data to the top of the struct
- os.notify: implement the kqueue backend for notify.FdNotifier (#19057)
- vlib: add a new module
builtin.wchar
, to ease dealing with C APIs that acceptwchar_t*
(#18794) - arrays: add more util functions and tests for them - find_first, find_last, join_to_string (#18784)
- vlib: use sync.new_mutex() consistently for initialising all vlib structures containing mutex fields
- crypto.pem: add a static method
Block.new
, to replacenew
(#18846) - crypto.pem: add decode_only and general improvements to decoding (#18908)
- log: improve the most common use case, it's no longer necessary to create a
Log
instance (#19242) - crypto.sha512: make the new384/0, new512_256/0, new512_224/0 functions public
- json: fix option alias support (#18801)
- time: fix
parse_format
withYY
(#18887) - math.big: allow bitwise ops on negative signum (#18912)
- math.big: make is_odd public and add test cases (#18916)
- math.big: add checked division methods (#18924)
- math.big: add
isqrt_checked
and standardize error format (#18939) - sokol: use GLCORE33 on linux
- os,term.termios: add termios.set_state/2, state.disable_echo/0, use them in os.input_password, to fix
v -os wasm32_emscripten examples/2048/
- gg: implement Android specific APK asset loading for the
create_image
function (#19015) - sync: make sync.Direction public (#19047)
- time: store time with nanosecond resolution in time.Time, deprecate Time.microsecond, add utility methods and tests (#19062)
- time: add a format_rfc3339_nano() method to time.Time
- time: add 'i', 'ii' in custom_format() for 12-hours clock(0-12-1-11) (#19083)
- gg: expand the
-d show_fps
background, so fps>100 will not overflow it - Math.big: restore gdc_euclid, use it for smaller numbers, fix bench_euclid.v .
- Add new generic
arrays.uniq, arrays.uniq_only, arrays.uniq_only_repeated, arrays.uniq_all_repeated, arrays.distinct
- builtin: add support for
-d bultin_writeln_should_write_at_once
and-d bultin_write_buf_to_fd_should_use_c_write
(#19243) - builtin: always show the assert message, if it was defined in the source, in non test programs too (fix #19240)
- time: check if a day is a valid day of its month (#19232)
- toml: Add generic automatic decoding and encoding of simple structs, when they don't implement custom methods (#17970)
Web
- http: Request.host
- net.ftp: fix dir() for file names, which contain spaces (fix #18800) (#18804)
- net.http: make listener public, and add addr in Server struct (#18871)
- net.http.chunked: return
!string
on decode (#18928) - net.conv: rename functions to match other langs, making them easier t… (#18937)
- wasm: remove dependency on thirdparty/binaryen, webassembly backend rewrite (#18120)
- wasm: add a -wasm-stack-top flag to compiler (#19157)
- net.mbedtls: add SSLListener to allow creating SSL servers (#19022)
- picoev, picohttparser: reimplement in V (#18506)
- vweb: fix parsing of form fields, send with multipart/form-data (by JS fetch)
- vweb: make vweb route paths case sensitive (#18973)
- net.mbedtls: have shutdown close accepted connections too (#19164)
- http: add support for stream connections, and custom .on_redirect, .on_progress, .on_finish callbacks to http.fetch() (#19184)
- vweb: add a user_agent utility method to the vweb context (#19204)
- vweb: avoid the controllers having to be defined in specific order (#19182)
ORM
- orm: fix inserting sequential values (id=0), in tables with an i64 primary field (#18791)
- Add OR in where on update and delete (#19172)
Database drivers
- vlib: remove deprecated
pg
,mysql
,sqlite
,mssql
modules. Leave only thedb.
prefixeddb.pg
,db.mysql
etc - db.mysql: add the exec family of methods (#19132)
- db.sqlite: add exec_param_many and exec_param methods (#19071)
- db.sqlite: make functions return results, breaking change (#19093)
Native backend
- native: move functions out of amd64.v (#18857)
C backend
- Fix selector code to use interface method table on closure when needed (#18736)
- Fix nested or expr call (fix #18803) (#18807)
- Ensure that
<<
and>>
has higher precedence in the generated C code, than arithmetic operations (diff between C and V precedences) (#18814) - Fix cross assign with aliased array (#18830)
- Fix generated code for returning generic result/option to comptime var (#18834)
- Fix option map with fn type value (#18849)
- Fix returning an option tuple -
fn f() ?(int,int) { return g() }
(#18851) - Fix printing multiple fixed array (fix #18866) (#18879)
- Fix infix expr with number overflow (fix #18905) (#18936)
- Remove \r for consistency (#18962)
- Allow dump(unsafe{nil}) and dump(voidptr(123)) in the same program
- Implement fixed array of threads wait() (#19032)
- Fix an error with ptr interpolation (fix #19048) (#19049)
- Fix spawn call fn struct field(fix #18862) (#19096)
- Fix bootstrapping on older macOS Catalina
- Fix alias of array method call(fix #19125) (#19129)
- Simplifications and clean up.
- Fix mixed fixed array and array initializing (#19246)
- Fix array sort with fn call parameter (fix #19220) (#19221)
- Fix generic struct with option fn field (#19218)
- Fix comptime assign with generic result return type (#19192)
- Fix match with comptime if expr in branch (#19189)
Tools
- ci: add v-analyzer builds (#18835)
- ci: cleanup more the contents of the generated v_linux.zip, v_macos.zip, and v_windows.zip, use -skip-unused
- tools: fix vcomplete for zsh (#18950)
- tools: support a toc for projects, with single exposing module, in
v doc
(#19001) - Add support for
v should-compile-all -c examples/
, which will delete all the produced executables at the end - vgret: add install commands for ubuntu and arch to doc string (#19247)
- fast.v: add favicon to the h...
weekly.2023.35
releases: weekly.2023.35
weekly.2023.33
releases: weekly.2023.33
weekly.2023.32.2
releases: weekly.2023.32.2
weekly.2023.32
releases: weekly.2023.32
weekly.2023.31
releases: weekly.2023.31