@@ -2344,7 +2344,7 @@ V doesn't have default function arguments or named arguments, for that trailing
2344
2344
literal syntax can be used instead:
2345
2345
2346
2346
``` v
2347
- [params]
2347
+ @ [params]
2348
2348
struct ButtonConfig {
2349
2349
text string
2350
2350
is_disabled bool
@@ -2470,7 +2470,7 @@ For an example, consider the following source in a directory `sample`:
2470
2470
``` v oksyntax
2471
2471
module sample
2472
2472
2473
- [noinit]
2473
+ @ [noinit]
2474
2474
pub struct Information {
2475
2475
pub:
2476
2476
data string
@@ -4488,7 +4488,7 @@ be achieved by tagging your assert containing functions with an `[assert_continu
4488
4488
tag, for example running this program:
4489
4489
4490
4490
``` v
4491
- [assert_continues]
4491
+ @ [assert_continues]
4492
4492
fn abc(ii int) {
4493
4493
assert ii == 2
4494
4494
}
@@ -4640,7 +4640,7 @@ data types:
4640
4640
``` v
4641
4641
struct MyType {}
4642
4642
4643
- [unsafe]
4643
+ @ [unsafe]
4644
4644
fn (data &MyType) free() {
4645
4645
// ...
4646
4646
}
@@ -4813,7 +4813,7 @@ mut:
4813
4813
}
4814
4814
4815
4815
// see discussion below
4816
- [heap]
4816
+ @ [heap]
4817
4817
struct MyStruct {
4818
4818
n int
4819
4819
}
@@ -4974,7 +4974,7 @@ V's ORM provides a number of benefits:
4974
4974
import db.sqlite
4975
4975
4976
4976
// sets a custom table name. Default is struct name (case-sensitive)
4977
- [table: 'customers']
4977
+ @ [table: 'customers']
4978
4978
struct Customer {
4979
4979
id int [primary; sql: serial] // a field named `id` of integer type must be the first field
4980
4980
name string [nonull]
@@ -5353,7 +5353,7 @@ function/struct/enum declaration and applies only to the following declaration.
5353
5353
` ` ` v
5354
5354
// [flag] enables Enum types to be used as bitfields
5355
5355
5356
- [flag]
5356
+ @ [flag]
5357
5357
enum BitField {
5358
5358
read
5359
5359
write
@@ -5395,13 +5395,13 @@ Function/method deprecations:
5395
5395
` ` ` v
5396
5396
// Calling this function will result in a deprecation warning
5397
5397
5398
- [deprecated]
5398
+ @ [deprecated]
5399
5399
fn old_function () {
5400
5400
}
5401
5401
5402
5402
// It can also display a custom deprecation message
5403
5403
5404
- [deprecated: ' use new_function() instead' ]
5404
+ @ [deprecated: ' use new_function() instead' ]
5405
5405
fn legacy_function () {}
5406
5406
5407
5407
// You can also specify a date, after which the function will be
@@ -5413,19 +5413,19 @@ fn legacy_function() {}
5413
5413
// 6 months after the deprecation date, calls will be hard
5414
5414
// compiler errors.
5415
5415
5416
- [deprecated: ' use new_function2() instead' ]
5417
- [deprecated_after: ' 2021-05-27' ]
5416
+ @ [deprecated: ' use new_function2() instead' ]
5417
+ @ [deprecated_after: ' 2021-05-27' ]
5418
5418
fn legacy_function2 () {}
5419
5419
` ` `
5420
5420
5421
5421
` ` ` v nofmt
5422
5422
// This function' s calls will be inlined.
5423
- [inline]
5423
+ @ [inline]
5424
5424
fn inlined_function() {
5425
5425
}
5426
5426
5427
5427
// This function' s calls will NOT be inlined.
5428
- [noinline]
5428
+ @ [noinline]
5429
5429
fn function () {
5430
5430
}
5431
5431
@@ -5434,21 +5434,21 @@ fn function() {
5434
5434
// just like exit/1 or panic/1. Such functions can not
5435
5435
// have return types, and should end either in for{}, or
5436
5436
// by calling other ` [noreturn]` functions.
5437
- [noreturn]
5437
+ @ [noreturn]
5438
5438
fn forever () {
5439
5439
for {}
5440
5440
}
5441
5441
5442
5442
// The following struct must be allocated on the heap. Therefore, it can only be used as a
5443
5443
// reference (` & Window` ) or inside another reference (` & OuterStruct{ Window{...} }` ).
5444
5444
// See section " Stack and Heap"
5445
- [heap]
5445
+ @ [heap]
5446
5446
struct Window {
5447
5447
}
5448
5448
5449
5449
// V will not generate this function and all its calls if the provided flag is false.
5450
5450
// To use a flag, use ` v -d flag`
5451
- [if debug]
5451
+ @ [if debug]
5452
5452
fn foo () {
5453
5453
}
5454
5454
@@ -5458,7 +5458,7 @@ fn bar() {
5458
5458
5459
5459
// The memory pointed to by the pointer arguments of this function will not be
5460
5460
// freed by the garbage collector (if in use) before the function returns
5461
- [keep_args_alive]
5461
+ @ [keep_args_alive]
5462
5462
fn C.my_external_function(voidptr, int, voidptr) int
5463
5463
5464
5464
// Calls to following function must be in unsafe{} blocks.
@@ -5467,7 +5467,7 @@ fn C.my_external_function(voidptr, int, voidptr) int
5467
5467
// This is useful, when you want to have an ` [unsafe]` function that
5468
5468
// has checks before/after a certain unsafe operation, that will still
5469
5469
// benefit from V' s safety features.
5470
- [unsafe]
5470
+ @ [unsafe]
5471
5471
fn risky_business() {
5472
5472
// code that will be checked, perhaps checking pre conditions
5473
5473
unsafe {
@@ -5483,22 +5483,22 @@ fn risky_business() {
5483
5483
5484
5484
// V' s autofree engine will not take care of memory management in this function.
5485
5485
// You will have the responsibility to free memory manually yourself in it.
5486
- [manualfree]
5486
+ @ [manualfree]
5487
5487
fn custom_allocations () {
5488
5488
}
5489
5489
5490
5490
// For C interop only, tells V that the following struct is defined with ` typedef struct` in C
5491
- [typedef]
5491
+ @ [typedef]
5492
5492
pub struct C.Foo {
5493
5493
}
5494
5494
5495
5495
// Used to add a custom calling convention to a function, available calling convention: stdcall, fastcall and cdecl.
5496
5496
// This list also applies for type aliases (see below).
5497
- [callconv: " stdcall" ]
5497
+ @ [callconv: " stdcall" ]
5498
5498
fn C.DefWindowProc(hwnd int, msg int, lparam int, wparam int)
5499
5499
5500
5500
// Used to add a custom calling convention to a function type aliases.
5501
- [callconv: " fastcall" ]
5501
+ @ [callconv: " fastcall" ]
5502
5502
type FastFn = fn (int) bool
5503
5503
5504
5504
// Windows only:
@@ -5508,7 +5508,7 @@ type FastFn = fn (int) bool
5508
5508
// (e)println output can be seen.
5509
5509
// Use it to force-open a terminal to view output in, even if the app is started from Explorer.
5510
5510
// Valid before main () only.
5511
- [console]
5511
+ @ [console]
5512
5512
fn main () {
5513
5513
}
5514
5514
` ` `
@@ -6776,7 +6776,7 @@ For example, `fn foo() {}` in module `bar` will result in `bar__foo()`.
6776
6776
To use a custom export name, use the ` [export]` attribute:
6777
6777
6778
6778
` ` `
6779
- [export: ' my_custom_c_name' ]
6779
+ @ [export: ' my_custom_c_name' ]
6780
6780
fn foo () {
6781
6781
}
6782
6782
` ` `
@@ -6902,7 +6902,7 @@ module main
6902
6902
6903
6903
import time
6904
6904
6905
- [live]
6905
+ @ [live]
6906
6906
fn print_message () {
6907
6907
println(' Hello! Modify this message while the program is running.' )
6908
6908
}
0 commit comments