diff --git a/examples/coroutines/coroutines_bench.v b/examples/coroutines/coroutines_bench.v index 1b489a603b..cb98d7f958 100644 --- a/examples/coroutines/coroutines_bench.v +++ b/examples/coroutines/coroutines_bench.v @@ -11,7 +11,7 @@ const run_time = 10 * time.second fn request(mut mu sync.Mutex, count &int) { for { http.get('http://vlang.io/utc_now') or { panic(err) } - mu.@lock() + mu.lock() unsafe { (*count)++ } diff --git a/examples/js_dom_draw_benchmark_chart/chart/main.v b/examples/js_dom_draw_benchmark_chart/chart/main.v index 1fbeeb876d..ce297269a6 100644 --- a/examples/js_dom_draw_benchmark_chart/chart/main.v +++ b/examples/js_dom_draw_benchmark_chart/chart/main.v @@ -17,9 +17,9 @@ mut: } struct FrameworkBenchmarkResponse { - insert []int - @select []int - update []int + insert []int + select []int + update []int } struct FrameworkPlatform { @@ -125,9 +125,9 @@ fn insert_framework_benchmark_times() !FrameworkPlatform { fn select_framework_benchmark_times() !FrameworkPlatform { numbers := FrameworkPlatform{ - v_sqlite_memory: v_sqlite_memory()!.@select - // v_sqlite_file: v_sqlite_file()!.@select - typescript_sqlite_memory: typescript_sqlite_memory()!.@select + v_sqlite_memory: v_sqlite_memory()!.select + // v_sqlite_file: v_sqlite_file()!.select + typescript_sqlite_memory: typescript_sqlite_memory()!.select } return numbers @@ -136,7 +136,7 @@ fn select_framework_benchmark_times() !FrameworkPlatform { fn update_framework_benchmark_times() !FrameworkPlatform { numbers := FrameworkPlatform{ v_sqlite_memory: v_sqlite_memory()!.update - // v_sqlite_file: v_sqlite_file()!.@select + // v_sqlite_file: v_sqlite_file()!.select typescript_sqlite_memory: typescript_sqlite_memory()!.update } @@ -162,9 +162,9 @@ fn v_sqlite_file() !FrameworkBenchmarkResponse { // res := http.get(url) or { panic(err) } // framework_benchmark_response := json.decode(FrameworkBenchmarkResponse, res.body)! framework_benchmark_response := FrameworkBenchmarkResponse{ - insert: [] - @select: [] - update: [] + insert: [] + select: [] + update: [] } return framework_benchmark_response } diff --git a/examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v b/examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v index 2a9bf030b9..9d52cfa39e 100644 --- a/examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v +++ b/examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v @@ -17,9 +17,9 @@ mut: } struct Response { - insert []int - @select []int - update []int + insert []int + select []int + update []int } fn main() { @@ -93,9 +93,9 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result { } or { panic(err) } response := Response{ - insert: insert_stopwatchs - @select: select_stopwatchs - update: update_stopwatchs + insert: insert_stopwatchs + select: select_stopwatchs + update: update_stopwatchs } return app.json(response) } @@ -103,9 +103,9 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result { @['/sqlite-file/:count'] pub fn (mut app App) sqlite_file(count int) vweb.Result { response := Response{ - insert: [] - @select: [] - update: [] + insert: [] + select: [] + update: [] } return app.json(response) } @@ -113,9 +113,9 @@ pub fn (mut app App) sqlite_file(count int) vweb.Result { @['/postgres/:count'] pub fn (mut app App) postgres(count int) vweb.Result { response := Response{ - insert: [] - @select: [] - update: [] + insert: [] + select: [] + update: [] } return app.json(response) } @@ -123,9 +123,9 @@ pub fn (mut app App) postgres(count int) vweb.Result { @['/mysql/:count'] pub fn (mut app App) mysql(count int) vweb.Result { response := Response{ - insert: [] - @select: [] - update: [] + insert: [] + select: [] + update: [] } return app.json(response) } diff --git a/vlib/clipboard/x11/clipboard.c.v b/vlib/clipboard/x11/clipboard.c.v index 4f34dc1ecc..cc2a7bfe96 100644 --- a/vlib/clipboard/x11/clipboard.c.v +++ b/vlib/clipboard/x11/clipboard.c.v @@ -215,7 +215,7 @@ pub fn (mut cb Clipboard) free() { } pub fn (mut cb Clipboard) clear() { - cb.mutex.@lock() + cb.mutex.lock() C.XSetSelectionOwner(cb.display, cb.selection, Window(0), C.CurrentTime) C.XFlush(cb.display) cb.is_owner = false @@ -237,7 +237,7 @@ pub fn (mut cb Clipboard) set_text(text string) bool { if cb.window == Window(0) { return false } - cb.mutex.@lock() + cb.mutex.lock() cb.text = text cb.is_owner = true cb.take_ownership() @@ -281,7 +281,7 @@ fn (mut cb Clipboard) transmit_selection(xse &C.XSelectionEvent) bool { C.XChangeProperty(xse.display, xse.requestor, xse.property, cb.get_atom(.xa_atom), 32, C.PropModeReplace, targets.data, targets.len) } else if cb.is_supported_target(xse.target) && cb.is_owner && cb.text != '' { - cb.mutex.@lock() + cb.mutex.lock() C.XChangeProperty(xse.display, xse.requestor, xse.property, xse.target, 8, C.PropModeReplace, cb.text.str, cb.text.len) cb.mutex.unlock() @@ -313,7 +313,7 @@ fn (mut cb Clipboard) start_listener() { if unsafe { event.xselectionclear.window == cb.window } && unsafe { event.xselectionclear.selection == cb.selection } { - cb.mutex.@lock() + cb.mutex.lock() cb.is_owner = false cb.text = '' cb.mutex.unlock() @@ -358,7 +358,7 @@ fn (mut cb Clipboard) start_listener() { } else if unsafe { event.xselection.target == to_be_requested } { sent_request = false to_be_requested = Atom(0) - cb.mutex.@lock() + cb.mutex.lock() prop := unsafe { read_property(event.xselection.display, event.xselection.requestor, event.xselection.property) diff --git a/vlib/context/cancel.v b/vlib/context/cancel.v index 7dcf3a1927..087b752364 100644 --- a/vlib/context/cancel.v +++ b/vlib/context/cancel.v @@ -60,14 +60,14 @@ pub fn (ctx &CancelContext) deadline() ?time.Time { } pub fn (mut ctx CancelContext) done() chan int { - ctx.mutex.@lock() + ctx.mutex.lock() done := ctx.done ctx.mutex.unlock() return done } pub fn (mut ctx CancelContext) err() IError { - ctx.mutex.@lock() + ctx.mutex.lock() err := ctx.err ctx.mutex.unlock() return err @@ -89,7 +89,7 @@ fn (mut ctx CancelContext) cancel(remove_from_parent bool, err IError) { panic('context: internal error: missing cancel error') } - ctx.mutex.@lock() + ctx.mutex.lock() if ctx.err !is none { ctx.mutex.unlock() // already canceled diff --git a/vlib/context/onecontext/onecontext.v b/vlib/context/onecontext/onecontext.v index c9c4365475..697d8a2370 100644 --- a/vlib/context/onecontext/onecontext.v +++ b/vlib/context/onecontext/onecontext.v @@ -61,7 +61,7 @@ pub fn (octx OneContext) done() chan int { } pub fn (mut octx OneContext) err() IError { - octx.err_mutex.@lock() + octx.err_mutex.lock() defer { octx.err_mutex.unlock() } @@ -102,7 +102,7 @@ pub fn (octx OneContext) str() string { pub fn (mut octx OneContext) cancel(err IError) { octx.cancel_fn() - octx.err_mutex.@lock() + octx.err_mutex.lock() octx.err = err octx.err_mutex.unlock() if !octx.done.closed { diff --git a/vlib/db/mysql/mysql_orm_test.v b/vlib/db/mysql/mysql_orm_test.v index f09074a14d..6ef11c0355 100644 --- a/vlib/db/mysql/mysql_orm_test.v +++ b/vlib/db/mysql/mysql_orm_test.v @@ -83,7 +83,7 @@ fn test_mysql_orm() { data: [orm.string_to_primitive('Louis'), orm.int_to_primitive(101)] }) or { panic(err) } - res := db.@select(orm.SelectConfig{ + res := db.select(orm.SelectConfig{ table: 'Test' has_where: true fields: ['id', 'name', 'age'] diff --git a/vlib/db/mysql/orm.c.v b/vlib/db/mysql/orm.c.v index 149f3ee458..ab7c6b54c0 100644 --- a/vlib/db/mysql/orm.c.v +++ b/vlib/db/mysql/orm.c.v @@ -3,8 +3,8 @@ module mysql import orm import time -// @select is used internally by V's ORM for processing `SELECT ` queries. -pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { +// select is used internally by V's ORM for processing `SELECT ` queries. +pub fn (db DB) select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { query := orm.orm_select_gen(config, '`', false, '?', 0, where) mut result := [][]orm.Primitive{} mut stmt := db.init_stmt(query) diff --git a/vlib/db/pg/orm.v b/vlib/db/pg/orm.v index fc5053300e..0caf692560 100644 --- a/vlib/db/pg/orm.v +++ b/vlib/db/pg/orm.v @@ -6,8 +6,8 @@ import net.conv // sql expr -// @select is used internally by V's ORM for processing `SELECT ` queries -pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { +// select is used internally by V's ORM for processing `SELECT ` queries +pub fn (db DB) select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { query := orm.orm_select_gen(config, '"', true, '$', 1, where) rows := pg_stmt_worker(db, query, where, data)! diff --git a/vlib/db/pg/pg_orm_test.v b/vlib/db/pg/pg_orm_test.v index dacd5bf3b2..eaac68b19c 100644 --- a/vlib/db/pg/pg_orm_test.v +++ b/vlib/db/pg/pg_orm_test.v @@ -97,7 +97,7 @@ fn test_pg_orm() { data: [orm.string_to_primitive('Louis'), orm.int_to_primitive(101)] }) or { panic(err) } - res := db.@select(orm.SelectConfig{ + res := db.select(orm.SelectConfig{ table: 'Test' is_count: false has_where: true diff --git a/vlib/db/sqlite/orm.v b/vlib/db/sqlite/orm.v index adfa9a0d4c..a6b09d3e1e 100644 --- a/vlib/db/sqlite/orm.v +++ b/vlib/db/sqlite/orm.v @@ -3,12 +3,12 @@ module sqlite import orm import time -// @select is used internally by V's ORM for processing `SELECT ` queries -pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { +// select is used internally by V's ORM for processing `SELECT ` queries +pub fn (db DB) select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { // 1. Create query and bind necessary data query := orm.orm_select_gen(config, '`', true, '?', 1, where) $if trace_sqlite ? { - eprintln('> @select query: "${query}"') + eprintln('> select query: "${query}"') } stmt := db.new_init_stmt(query)! defer { diff --git a/vlib/db/sqlite/sqlite_orm_test.v b/vlib/db/sqlite/sqlite_orm_test.v index cabbc10d28..9a063490bb 100644 --- a/vlib/db/sqlite/sqlite_orm_test.v +++ b/vlib/db/sqlite/sqlite_orm_test.v @@ -63,7 +63,7 @@ fn test_sqlite_orm() { data: [orm.string_to_primitive('Louis'), orm.i64_to_primitive(100)] }) or { panic(err) } - res := db.@select(orm.SelectConfig{ + res := db.select(orm.SelectConfig{ table: 'Test' has_where: true fields: ['id', 'name', 'age'] diff --git a/vlib/log/safe_log.v b/vlib/log/safe_log.v index 8f88d5f6f5..f8fdb131d8 100644 --- a/vlib/log/safe_log.v +++ b/vlib/log/safe_log.v @@ -32,7 +32,7 @@ pub fn (mut x ThreadSafeLog) free() { // set_level changes the log level pub fn (mut x ThreadSafeLog) set_level(level Level) { - x.mu.@lock() + x.mu.lock() x.Log.set_level(level) x.mu.unlock() } @@ -40,35 +40,35 @@ pub fn (mut x ThreadSafeLog) set_level(level Level) { // set_always_flush called with true, will make the log flush after every single .fatal(), .error(), .warn(), .info(), .debug() call. // That can be much slower, if you plan to do lots of frequent calls, but if your program exits early or crashes, your logs will be more complete. pub fn (mut x ThreadSafeLog) set_always_flush(should_flush bool) { - x.mu.@lock() + x.mu.lock() x.Log.set_always_flush(should_flush) x.mu.unlock() } // debug logs a debug message pub fn (mut x ThreadSafeLog) debug(s string) { - x.mu.@lock() + x.mu.lock() x.Log.debug(s) x.mu.unlock() } // info logs an info messagep pub fn (mut x ThreadSafeLog) info(s string) { - x.mu.@lock() + x.mu.lock() x.Log.info(s) x.mu.unlock() } // warn logs a warning message pub fn (mut x ThreadSafeLog) warn(s string) { - x.mu.@lock() + x.mu.lock() x.Log.warn(s) x.mu.unlock() } // error logs an error message pub fn (mut x ThreadSafeLog) error(s string) { - x.mu.@lock() + x.mu.lock() x.Log.error(s) x.mu.unlock() } @@ -76,7 +76,7 @@ pub fn (mut x ThreadSafeLog) error(s string) { // fatal logs a fatal message, and panics @[noreturn] pub fn (mut x ThreadSafeLog) fatal(s string) { - x.mu.@lock() + x.mu.lock() defer { // TODO: Log.fatal() is marked as noreturn, but this defer is allowed. // Think whether it should be, or if it should be a compiler notice at least, diff --git a/vlib/net/aasocket.c.v b/vlib/net/aasocket.c.v index f68fbcb90b..d5c5c7b99b 100644 --- a/vlib/net/aasocket.c.v +++ b/vlib/net/aasocket.c.v @@ -104,7 +104,7 @@ fn C.ioctlsocket(s int, cmd int, argp &u32) int fn C.fcntl(fd int, cmd int, arg ...voidptr) int -fn C.@select(ndfs int, readfds &C.fd_set, writefds &C.fd_set, exceptfds &C.fd_set, timeout &C.timeval) int +fn C.select(ndfs int, readfds &C.fd_set, writefds &C.fd_set, exceptfds &C.fd_set, timeout &C.timeval) int fn C.FD_ZERO(fdset &C.fd_set) diff --git a/vlib/net/common.c.v b/vlib/net/common.c.v index 58f084cee9..9dbdfc6e2b 100644 --- a/vlib/net/common.c.v +++ b/vlib/net/common.c.v @@ -106,7 +106,7 @@ pub fn close(handle int) ! { } // Select waits for an io operation (specified by parameter `test`) to be available -fn @select(handle int, test Select, timeout time.Duration) !bool { +fn select(handle int, test Select, timeout time.Duration) !bool { set := C.fd_set{} C.FD_ZERO(&set) @@ -130,13 +130,13 @@ fn @select(handle int, test Select, timeout time.Duration) !bool { match test { .read { - socket_error(C.@select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! + socket_error(C.select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! } .write { - socket_error(C.@select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! + socket_error(C.select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! } .except { - socket_error(C.@select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! + socket_error(C.select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! } } @@ -149,7 +149,7 @@ fn select_deadline(handle int, test Select, deadline time.Time) !bool { infinite := deadline.unix() == 0 for infinite || time.now() <= deadline { timeout := if infinite { infinite_timeout } else { deadline - time.now() } - ready := @select(handle, test, timeout) or { + ready := select(handle, test, timeout) or { if err.code() == C.EINTR { // errno is 4, Spurious wakeup from signal, keep waiting continue diff --git a/vlib/net/http/method.v b/vlib/net/http/method.v index a24a86fa23..70b1ab0605 100644 --- a/vlib/net/http/method.v +++ b/vlib/net/http/method.v @@ -21,7 +21,7 @@ pub enum Method { // as of 2023-06-20 delete label link - @lock + lock merge mkactivity mkcalendar @@ -66,7 +66,7 @@ pub fn (m Method) str() string { .delete { 'DELETE' } .label { 'LABEL' } .link { 'LINK' } - .@lock { 'LOCK' } + .lock { 'LOCK' } .merge { 'MERGE' } .mkactivity { 'MKACTIVITY' } .mkcalendar { 'MKCALENDAR' } @@ -115,7 +115,7 @@ pub fn method_from_str(m string) Method { 'DELETE' { Method.delete } 'LABEL' { Method.label } 'LINK' { Method.link } - 'LOCK' { Method.@lock } + 'LOCK' { Method.lock } 'MERGE' { Method.merge } 'MKACTIVITY' { Method.mkactivity } 'MKCALENDAR' { Method.mkcalendar } diff --git a/vlib/net/mbedtls/ssl_connection.c.v b/vlib/net/mbedtls/ssl_connection.c.v index 20f23cb6ea..706b24ac67 100644 --- a/vlib/net/mbedtls/ssl_connection.c.v +++ b/vlib/net/mbedtls/ssl_connection.c.v @@ -629,7 +629,7 @@ pub fn (mut s SSLConn) write_string(str string) !int { } // Select waits for an io operation (specified by parameter `test`) to be available -fn @select(handle int, test Select, timeout time.Duration) !bool { +fn select(handle int, test Select, timeout time.Duration) !bool { $if trace_ssl ? { eprintln('${@METHOD} handle: ${handle}, timeout: ${timeout}') } @@ -656,13 +656,13 @@ fn @select(handle int, test Select, timeout time.Duration) !bool { mut res := -1 match test { .read { - res = net.socket_error(C.@select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! + res = net.socket_error(C.select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! } .write { - res = net.socket_error(C.@select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! + res = net.socket_error(C.select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! } .except { - res = net.socket_error(C.@select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! + res = net.socket_error(C.select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! } } if res < 0 { @@ -688,7 +688,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool { // wait_for wraps the common wait code fn wait_for(handle int, what Select, timeout time.Duration) ! { - ready := @select(handle, what, timeout)! + ready := select(handle, what, timeout)! if ready { return } diff --git a/vlib/net/openssl/ssl_connection.c.v b/vlib/net/openssl/ssl_connection.c.v index 588820bd1f..6809e40bfa 100644 --- a/vlib/net/openssl/ssl_connection.c.v +++ b/vlib/net/openssl/ssl_connection.c.v @@ -384,7 +384,7 @@ pub fn (mut s SSLConn) write_string(str string) !int { } // Select waits for an io operation (specified by parameter `test`) to be available -fn @select(handle int, test Select, timeout time.Duration) !bool { +fn select(handle int, test Select, timeout time.Duration) !bool { $if trace_ssl ? { eprintln('${@METHOD} handle: ${handle}, timeout: ${timeout}') } @@ -411,13 +411,13 @@ fn @select(handle int, test Select, timeout time.Duration) !bool { mut res := -1 match test { .read { - res = net.socket_error(C.@select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! + res = net.socket_error(C.select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! } .write { - res = net.socket_error(C.@select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! + res = net.socket_error(C.select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! } .except { - res = net.socket_error(C.@select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! + res = net.socket_error(C.select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! } } if res < 0 { @@ -443,7 +443,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool { // wait_for wraps the common wait code fn wait_for(handle int, what Select, timeout time.Duration) ! { - ready := @select(handle, what, timeout)! + ready := select(handle, what, timeout)! if ready { return } diff --git a/vlib/net/tcp.c.v b/vlib/net/tcp.c.v index 18743fdd2e..b518f7c13e 100644 --- a/vlib/net/tcp.c.v +++ b/vlib/net/tcp.c.v @@ -145,7 +145,7 @@ pub fn (c TcpConn) read_ptr(buf_ptr &u8, len int) !int { // The new socket returned by accept() behaves differently in blocking mode and needs special treatment. mut has_data := true if c.is_blocking { - if ok := @select(c.sock.handle, .read, 1) { + if ok := select(c.sock.handle, .read, 1) { has_data = ok } else { false @@ -392,7 +392,7 @@ pub fn listen_tcp(family AddrFamily, saddr string, options ListenOptions) !&TcpL for { code := error_code() if code in [int(error_einprogress), int(error_ewouldblock), int(error_eagain), C.EINTR] { - @select(s.handle, .read, connect_timeout)! + select(s.handle, .read, connect_timeout)! res = C.listen(s.handle, options.backlog) if res == 0 { break @@ -655,7 +655,7 @@ fn (mut s TcpSocket) connect(a Addr) ! { // determine whether connect() completed successfully (SO_ERROR is zero) or // unsuccessfully (SO_ERROR is one of the usual error codes listed here, // ex‐ plaining the reason for the failure). - write_result := @select(s.handle, .write, connect_timeout)! + write_result := select(s.handle, .write, connect_timeout)! err := 0 len := sizeof(err) xyz := C.getsockopt(s.handle, C.SOL_SOCKET, C.SO_ERROR, &err, &len) diff --git a/vlib/net/udp.c.v b/vlib/net/udp.c.v index c167e02363..a2897c9def 100644 --- a/vlib/net/udp.c.v +++ b/vlib/net/udp.c.v @@ -274,8 +274,8 @@ fn (mut s UdpSocket) close() ! { return close(s.handle) } -fn (mut s UdpSocket) @select(test Select, timeout time.Duration) !bool { - return @select(s.handle, test, timeout) +fn (mut s UdpSocket) select(test Select, timeout time.Duration) !bool { + return select(s.handle, test, timeout) } fn (s &UdpSocket) remote() !Addr { diff --git a/vlib/net/unix/common.c.v b/vlib/net/unix/common.c.v index 376fec6a90..ffb9a205fa 100644 --- a/vlib/net/unix/common.c.v +++ b/vlib/net/unix/common.c.v @@ -29,7 +29,7 @@ pub fn shutdown(handle int, config net.ShutdownConfig) int { } // Select waits for an io operation (specified by parameter `test`) to be available -fn @select(handle int, test Select, timeout time.Duration) !bool { +fn select(handle int, test Select, timeout time.Duration) !bool { set := C.fd_set{} C.FD_ZERO(&set) @@ -53,13 +53,13 @@ fn @select(handle int, test Select, timeout time.Duration) !bool { match test { .read { - net.socket_error(C.@select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! + net.socket_error(C.select(handle + 1, &set, C.NULL, C.NULL, timeval_timeout))! } .write { - net.socket_error(C.@select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! + net.socket_error(C.select(handle + 1, C.NULL, &set, C.NULL, timeval_timeout))! } .except { - net.socket_error(C.@select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! + net.socket_error(C.select(handle + 1, C.NULL, C.NULL, &set, timeval_timeout))! } } @@ -72,7 +72,7 @@ fn select_deadline(handle int, test Select, deadline time.Time) !bool { infinite := deadline.unix() == 0 for infinite || time.now() <= deadline { timeout := if infinite { net.infinite_timeout } else { deadline - time.now() } - ready := @select(handle, test, timeout) or { + ready := select(handle, test, timeout) or { if err.code() == 4 { // Spurious wakeup from signal, keep waiting continue diff --git a/vlib/net/unix/stream.c.v b/vlib/net/unix/stream.c.v index c44536ad59..daaf3072bd 100644 --- a/vlib/net/unix/stream.c.v +++ b/vlib/net/unix/stream.c.v @@ -407,8 +407,8 @@ fn (mut s StreamSocket) close() ! { return close(s.handle) } -fn (mut s StreamSocket) @select(test Select, timeout time.Duration) !bool { - return @select(s.handle, test, timeout) +fn (mut s StreamSocket) select(test Select, timeout time.Duration) !bool { + return select(s.handle, test, timeout) } // set_option sets an option on the socket @@ -462,7 +462,7 @@ fn (mut s StreamSocket) connect(socket_path string) ! { if ecode == int(net.error_ewouldblock) { // The socket is nonblocking and the connection cannot be completed // immediately. Wait till the socket is ready to write - write_result := s.@select(.write, connect_timeout)! + write_result := s.select(.write, connect_timeout)! err := 0 len := sizeof(err) // determine whether connect() completed successfully (SO_ERROR is zero) diff --git a/vlib/orm/orm.v b/vlib/orm/orm.v index b5a4d1f50c..b9cc7b7892 100644 --- a/vlib/orm/orm.v +++ b/vlib/orm/orm.v @@ -193,7 +193,7 @@ pub: // Every function without last_id() returns an optional, which returns an error if present // last_id returns the last inserted id of the db pub interface Connection { - @select(config SelectConfig, data QueryData, where QueryData) ![][]Primitive + select(config SelectConfig, data QueryData, where QueryData) ![][]Primitive insert(table string, data QueryData) ! update(table string, data QueryData, where QueryData) ! delete(table string, where QueryData) ! diff --git a/vlib/orm/orm_null_test.v b/vlib/orm/orm_null_test.v index f4a2b4069b..23b60b036a 100644 --- a/vlib/orm/orm_null_test.v +++ b/vlib/orm/orm_null_test.v @@ -23,12 +23,12 @@ fn MockDB.new() &MockDB { } } -fn (db MockDB) @select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { +fn (db MockDB) select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive { mut st := db.st st.last = orm.orm_select_gen(config, '`', false, '?', 5, where) st.data = data.data st.where = where.data - return db.db.@select(config, data, where) + return db.db.select(config, data, where) } fn (db MockDB) insert(table string, data orm.QueryData) ! { diff --git a/vlib/os/fd.c.v b/vlib/os/fd.c.v index e530f4bbb0..a569976738 100644 --- a/vlib/os/fd.c.v +++ b/vlib/os/fd.c.v @@ -80,7 +80,7 @@ pub: tv_usec u64 } -fn C.@select(ndfs int, readfds &C.fd_set, writefds &C.fd_set, exceptfds &C.fd_set, timeout &C.timeval) int +fn C.select(ndfs int, readfds &C.fd_set, writefds &C.fd_set, exceptfds &C.fd_set, timeout &C.timeval) int // These are C macros, but from the V's point of view, can be treated as C functions: fn C.FD_ZERO(fdset &C.fd_set) @@ -97,7 +97,7 @@ pub fn fd_is_pending(fd int) bool { tv_sec: 0 tv_usec: 0 } - res := C.@select(fd + 1, &read_set, C.NULL, C.NULL, &ts) + res := C.select(fd + 1, &read_set, C.NULL, C.NULL, &ts) if res > 0 { if C.FD_ISSET(fd, &read_set) != 0 { return true diff --git a/vlib/picoev/loop_default.c.v b/vlib/picoev/loop_default.c.v index 95190820c8..2ba37ede8d 100644 --- a/vlib/picoev/loop_default.c.v +++ b/vlib/picoev/loop_default.c.v @@ -68,7 +68,7 @@ fn (mut pv Picoev) poll_once(max_wait_in_sec int) int { tv_sec: u64(max_wait_in_sec) tv_usec: 0 } - r := C.@select(maxfd + 1, &readfds, &writefds, &errorfds, &tv) + r := C.select(maxfd + 1, &readfds, &writefds, &errorfds, &tv) if r == -1 { // timeout return -1 diff --git a/vlib/sync/many_times.v b/vlib/sync/many_times.v index 0c46badcdd..a82d63cfdd 100644 --- a/vlib/sync/many_times.v +++ b/vlib/sync/many_times.v @@ -27,7 +27,7 @@ pub fn (mut m ManyTimes) do(f fn ()) { } fn (mut m ManyTimes) do_slow(f fn ()) { - m.m.@lock() + m.m.lock() if m.count < m.times { stdatomic.store_u64(&m.count, m.count + 1) f() diff --git a/vlib/sync/mutex_test.v b/vlib/sync/mutex_test.v index 3075024e4b..ed0e213dc2 100644 --- a/vlib/sync/mutex_test.v +++ b/vlib/sync/mutex_test.v @@ -6,7 +6,7 @@ pub mut: } fn write_10000(mut co Counter, mut mx sync.Mutex) { - mx.@lock() + mx.lock() co.i = 10000 mx.unlock() } @@ -14,7 +14,7 @@ fn write_10000(mut co Counter, mut mx sync.Mutex) { fn test_mutex() { mut co := &Counter{10086} mut mx := sync.new_mutex() - mx.@lock() + mx.lock() co.i = 888 th := spawn write_10000(mut co, mut mx) mx.unlock() // after mx unlock, thread write_10000 can continue @@ -31,7 +31,7 @@ fn test_try_lock_mutex() { } } mut mx := sync.new_mutex() - mx.@lock() + mx.lock() try_fail := mx.try_lock() assert try_fail == false mx.unlock() diff --git a/vlib/sync/once.v b/vlib/sync/once.v index 9afa8e2e2d..f03d8f3685 100644 --- a/vlib/sync/once.v +++ b/vlib/sync/once.v @@ -24,7 +24,7 @@ pub fn (mut o Once) do(f fn ()) { } fn (mut o Once) do_slow(f fn ()) { - o.m.@lock() + o.m.lock() if o.count < 1 { stdatomic.store_u64(&o.count, 1) f() @@ -56,7 +56,7 @@ pub fn (mut o Once) do_with_param(f fn (voidptr), param voidptr) { } fn (mut o Once) do_slow_with_param(f fn (p voidptr), param voidptr) { - o.m.@lock() + o.m.lock() if o.count < 1 { stdatomic.store_u64(&o.count, 1) f(param) diff --git a/vlib/sync/rwmutex_test.v b/vlib/sync/rwmutex_test.v index 342ed72c29..198921630d 100644 --- a/vlib/sync/rwmutex_test.v +++ b/vlib/sync/rwmutex_test.v @@ -7,7 +7,7 @@ pub mut: } fn write_10000(mut co Counter, mut mx sync.RwMutex) { - mx.@lock() + mx.lock() co.i = 10000 mx.unlock() } @@ -15,14 +15,14 @@ fn write_10000(mut co Counter, mut mx sync.RwMutex) { fn test_rwmutex() { mut co := &Counter{10086} mut mx := sync.new_rwmutex() - mx.@lock() + mx.lock() co.i = 888 th1 := spawn write_10000(mut co, mut mx) mx.unlock() // after mx unlock, thread write_10000 can continue th1.wait() assert co.i == 10000 - mx.@rlock() + mx.rlock() th2 := spawn write_10000(mut co, mut mx) // write_10000 will be blocked co.i = 999 // for demo purpose, don't modify data in rlock! time.sleep(1 * time.millisecond) @@ -43,7 +43,7 @@ fn test_try_lock_rwmutex() { mut mx := sync.new_rwmutex() // try_rlock will always fail when mx locked - mx.@lock() + mx.lock() try_fail_reading1 := mx.try_rlock() try_fail_writing1 := mx.try_wlock() assert try_fail_reading1 == false diff --git a/vlib/sync/sync_darwin.c.v b/vlib/sync/sync_darwin.c.v index 84e97317dc..9dcbcc7409 100644 --- a/vlib/sync/sync_darwin.c.v +++ b/vlib/sync/sync_darwin.c.v @@ -115,10 +115,10 @@ pub fn (mut m RwMutex) init() { C.pthread_rwlock_init(&m.mutex, &a.attr) } -// @lock locks the mutex instance (`lock` is a keyword). +// lock locks the mutex instance (`lock` is a keyword). // If the mutex was already locked, it will block, till it is unlocked. @[inline] -pub fn (mut m Mutex) @lock() { +pub fn (mut m Mutex) lock() { C.pthread_mutex_lock(&m.mutex) } @@ -130,7 +130,7 @@ pub fn (mut m Mutex) try_lock() bool { } // unlock unlocks the mutex instance. The mutex is released, and one of -// the other threads, that were blocked, because they called @lock can continue. +// the other threads, that were blocked, because they called lock can continue. @[inline] pub fn (mut m Mutex) unlock() { C.pthread_mutex_unlock(&m.mutex) @@ -146,25 +146,25 @@ pub fn (mut m Mutex) destroy() { } } -// @rlock locks the given RwMutex instance for reading. +// rlock locks the given RwMutex instance for reading. // If the mutex was already locked, it will block, and will try to get the lock, // once the lock is released by another thread calling unlock. // Once it succeds, it returns. // Note: there may be several threads that are waiting for the same lock. // Note: RwMutex has separate read and write locks. @[inline] -pub fn (mut m RwMutex) @rlock() { +pub fn (mut m RwMutex) rlock() { C.pthread_rwlock_rdlock(&m.mutex) } -// @lock locks the given RwMutex instance for writing. +// lock locks the given RwMutex instance for writing. // If the mutex was already locked, it will block, till it is unlocked, // then it will try to get the lock, and if it can, it will return, otherwise // it will continue waiting for the mutex to become unlocked. // Note: there may be several threads that are waiting for the same lock. // Note: RwMutex has separate read and write locks. @[inline] -pub fn (mut m RwMutex) @lock() { +pub fn (mut m RwMutex) lock() { C.pthread_rwlock_wrlock(&m.mutex) } diff --git a/vlib/sync/sync_default.c.v b/vlib/sync/sync_default.c.v index a8c921e292..e07b6ad646 100644 --- a/vlib/sync/sync_default.c.v +++ b/vlib/sync/sync_default.c.v @@ -102,10 +102,10 @@ pub fn (mut m RwMutex) init() { C.pthread_rwlockattr_destroy(&a.attr) // destroy the attr when done } -// @lock locks the mutex instance (`lock` is a keyword). +// lock locks the mutex instance (`lock` is a keyword). // If the mutex was already locked, it will block, till it is unlocked. @[inline] -pub fn (mut m Mutex) @lock() { +pub fn (mut m Mutex) lock() { C.pthread_mutex_lock(&m.mutex) } @@ -117,7 +117,7 @@ pub fn (mut m Mutex) try_lock() bool { } // unlock unlocks the mutex instance. The mutex is released, and one of -// the other threads, that were blocked, because they called @lock can continue. +// the other threads, that were blocked, because they called lock can continue. @[inline] pub fn (mut m Mutex) unlock() { C.pthread_mutex_unlock(&m.mutex) @@ -132,25 +132,25 @@ pub fn (mut m Mutex) destroy() { } } -// @rlock locks the given RwMutex instance for reading. +// rlock locks the given RwMutex instance for reading. // If the mutex was already locked, it will block, and will try to get the lock, // once the lock is released by another thread calling unlock. // Once it succeds, it returns. // Note: there may be several threads that are waiting for the same lock. // Note: RwMutex has separate read and write locks. @[inline] -pub fn (mut m RwMutex) @rlock() { +pub fn (mut m RwMutex) rlock() { C.pthread_rwlock_rdlock(&m.mutex) } -// @lock locks the given RwMutex instance for writing. +// lock locks the given RwMutex instance for writing. // If the mutex was already locked, it will block, till it is unlocked, // then it will try to get the lock, and if it can, it will return, otherwise // it will continue waiting for the mutex to become unlocked. // Note: there may be several threads that are waiting for the same lock. // Note: RwMutex has separate read and write locks. @[inline] -pub fn (mut m RwMutex) @lock() { +pub fn (mut m RwMutex) lock() { C.pthread_rwlock_wrlock(&m.mutex) } diff --git a/vlib/sync/sync_freebsd.c.v b/vlib/sync/sync_freebsd.c.v index 99d9a3e9a5..5711e22dc0 100644 --- a/vlib/sync/sync_freebsd.c.v +++ b/vlib/sync/sync_freebsd.c.v @@ -100,10 +100,10 @@ pub fn (mut m RwMutex) init() { C.pthread_rwlockattr_destroy(&a.attr) // destroy the attr when done } -// @lock locks the mutex instance (`lock` is a keyword). +// lock locks the mutex instance (`lock` is a keyword). // If the mutex was already locked, it will block, till it is unlocked. @[inline] -pub fn (mut m Mutex) @lock() { +pub fn (mut m Mutex) lock() { C.pthread_mutex_lock(&m.mutex) } @@ -115,7 +115,7 @@ pub fn (mut m Mutex) try_lock() bool { } // unlock unlocks the mutex instance. The mutex is released, and one of -// the other threads, that were blocked, because they called @lock can continue. +// the other threads, that were blocked, because they called lock can continue. @[inline] pub fn (mut m Mutex) unlock() { C.pthread_mutex_unlock(&m.mutex) @@ -130,25 +130,25 @@ pub fn (mut m Mutex) destroy() { } } -// @rlock locks the given RwMutex instance for reading. +// rlock locks the given RwMutex instance for reading. // If the mutex was already locked, it will block, and will try to get the lock, // once the lock is released by another thread calling unlock. // Once it succeds, it returns. // Note: there may be several threads that are waiting for the same lock. // Note: RwMutex has separate read and write locks. @[inline] -pub fn (mut m RwMutex) @rlock() { +pub fn (mut m RwMutex) rlock() { C.pthread_rwlock_rdlock(&m.mutex) } -// @lock locks the given RwMutex instance for writing. +// lock locks the given RwMutex instance for writing. // If the mutex was already locked, it will block, till it is unlocked, // then it will try to get the lock, and if it can, it will return, otherwise // it will continue waiting for the mutex to become unlocked. // Note: there may be several threads that are waiting for the same lock. // Note: RwMutex has separate read and write locks. @[inline] -pub fn (mut m RwMutex) @lock() { +pub fn (mut m RwMutex) lock() { C.pthread_rwlock_wrlock(&m.mutex) } diff --git a/vlib/sync/sync_windows.c.v b/vlib/sync/sync_windows.c.v index ace245463d..4b91a17462 100644 --- a/vlib/sync/sync_windows.c.v +++ b/vlib/sync/sync_windows.c.v @@ -72,7 +72,7 @@ pub fn (mut m RwMutex) init() { C.InitializeSRWLock(&m.mx) } -pub fn (mut m Mutex) @lock() { +pub fn (mut m Mutex) lock() { C.AcquireSRWLockExclusive(&m.mx) } @@ -94,11 +94,11 @@ pub fn (mut m Mutex) unlock() { } // RwMutex has separate read- and write locks -pub fn (mut m RwMutex) @rlock() { +pub fn (mut m RwMutex) rlock() { C.AcquireSRWLockShared(&m.mx) } -pub fn (mut m RwMutex) @lock() { +pub fn (mut m RwMutex) lock() { C.AcquireSRWLockExclusive(&m.mx) } diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index c74acadbcc..da33b23519 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -1395,7 +1395,7 @@ pub mut: pub struct EnumField { pub: name string // just `lock`, or `abc`, etc, no matter if the name is a keyword or not. - source_name string // The name in the source, for example `@lock`, and `abc`. Note that `lock` is a keyword in V. + source_name string // The name in the source, for example `lock`, and `abc`. Note that `lock` is a keyword in V. pos token.Pos pre_comments []Comment // comment before Enumfield comments []Comment // comment after Enumfield in the same line diff --git a/vlib/v/gen/c/orm.v b/vlib/v/gen/c/orm.v index a4ca2d6ce2..9f2f4102cd 100644 --- a/vlib/v/gen/c/orm.v +++ b/vlib/v/gen/c/orm.v @@ -22,8 +22,8 @@ enum SqlExprSide { // select from User // } // ``` -// cgen will write calling the function `@select` of the needed database. -// If you use sqlite, it calls `@select` from `vlib/db/sqlite/orm.v` +// cgen will write calling the function `select` of the needed database. +// If you use sqlite, it calls `select` from `vlib/db/sqlite/orm.v` // sql_select_expr writes C code that calls ORM functions for selecting objects // from the database, which is used by the `select` query. diff --git a/vlib/v/slow_tests/valgrind/sync.v b/vlib/v/slow_tests/valgrind/sync.v index 9bc45407cd..4ea33ad26e 100644 --- a/vlib/v/slow_tests/valgrind/sync.v +++ b/vlib/v/slow_tests/valgrind/sync.v @@ -2,14 +2,14 @@ import sync fn main() { mut mutex := sync.new_mutex() - mutex.@lock() + mutex.lock() mutex.unlock() mutex.destroy() mut rwmutex := sync.new_rwmutex() - rwmutex.@rlock() + rwmutex.rlock() rwmutex.unlock() - rwmutex.@lock() + rwmutex.lock() rwmutex.unlock() rwmutex.destroy() diff --git a/vlib/v/tests/enums/enum_from_generic_static_method_test.v b/vlib/v/tests/enums/enum_from_generic_static_method_test.v index 99ebafed2e..a28e850961 100644 --- a/vlib/v/tests/enums/enum_from_generic_static_method_test.v +++ b/vlib/v/tests/enums/enum_from_generic_static_method_test.v @@ -1,9 +1,9 @@ enum MyEnum { abc def - @lock + lock xyz - @if + if } @[flag] @@ -38,8 +38,8 @@ fn test_enum_from_string() { y := MyFlaggedEnum.from('xyz')! dump(y) assert y == .xyz - assert MyEnum.from('if')! == MyEnum.@if - assert MyEnum.from('lock')! == MyEnum.@lock + assert MyEnum.from('if')! == MyEnum.if + assert MyEnum.from('lock')! == MyEnum.lock if z := MyEnum.from('unknown') { assert false } else { diff --git a/vlib/v/tests/init_global_test.v b/vlib/v/tests/init_global_test.v index bbdb0eb1d9..9147bb0730 100644 --- a/vlib/v/tests/init_global_test.v +++ b/vlib/v/tests/init_global_test.v @@ -155,7 +155,7 @@ fn switch2() u64 { mut cnt := u64(0) for { cnt++ - mtx.@lock() + mtx.lock() f1, f2 = f2, f1 if f1 == 17.0 || f2 == 17.0 { mtx.unlock() @@ -170,18 +170,18 @@ fn test_global_mutex() { assert f1 == 34.0625 t := spawn switch2() for _ in 0 .. 25000 { - mtx.@lock() + mtx.lock() f1, f2 = f2, f1 mtx.unlock() } - mtx.@lock() + mtx.lock() if f1 == 0.0 { f1 = 17.0 } else { f2 = 17.0 } mtx.unlock() - mtx.@rlock() + mtx.rlock() assert (f1 == 17.0 && f2 == 34.0625) || (f1 == 34.0625 && f2 == 17.0) mtx.runlock() n := t.wait() diff --git a/vlib/v2/token/position.v b/vlib/v2/token/position.v index 2453f0b9f7..f139ce1309 100644 --- a/vlib/v2/token/position.v +++ b/vlib/v2/token/position.v @@ -46,7 +46,7 @@ pub fn FileSet.new() &FileSet { // TODO: pub fn (mut fs FileSet) add_file(filename string, base_ int, size int) &File { // eprintln('>>> add_file fs: ${voidptr(fs)} | filename: $filename | base_: $base_ | size: $size') - fs.mu.@lock() + fs.mu.lock() defer { fs.mu.unlock() } @@ -109,7 +109,7 @@ fn search_files(files []&File, x int) int { pub fn (mut fs FileSet) file(pos Pos) &File { // eprintln('>>>>>>>>> file fs: ${voidptr(fs)} | pos: $pos') - fs.mu.@lock() + fs.mu.lock() defer { fs.mu.unlock() }