Comments (7)
mut eb := new_event_bus[string]()
It's wrong to use it here.
We should use shared eb := new_event_bus[string]()
.
from v.
I cannot reproduce the problem on my Linux machine. How did you trigger it? When I run the program after compiling as shown, it just hangs until I hit Ctrl-C:
[jalon@7950x v]$ ./v -g -o vdbg cmd/v && ./vdbg event_bus_trial.v
[jalon@7950x v]$ ./event_bus_trial
^C
[jalon@7950x v]$
from v.
It is reproducible on macos:
0[15:17:22]@m1: (master) /opt/v $ v -cc clang run ee.v
signal 11: segmentation fault
0 libsystem_platform.dylib 0x00000001805af584 _sigtramp + 56
1 ee 0x00000001045542cc map_key_to_index + 36
2 ee 0x000000010453c3a4 map_exists + 32
3 ee 0x000000010457bdcc main__EventBus_T_string_subscribe_T_string + 112
4 ee 0x000000010457c070 main__main + 84
5 ee 0x000000010457c760 main + 84
6 dyld 0x00000001801f60e0 start + 2360
139[15:17:34]@m1: (master) /opt/v $
from v.
mut eb := new_event_bus[string]()
It's wrong to use it here. We should useshared eb := new_event_bus[string]()
.
That is right.
I think we should add a checker error, for mut eb
, used for methods with shared receivers.
struct Abc { x int }
fn f(shared a Abc) { lock a { println(a.x) } }
fn (shared a Abc) m(){ lock a { println(a.x) } }
// mut a := Abc{}
// f(a) // checker error
mut b := Abc{} // if b is not mutable, there is a checker error, telling the user to declare `b` with `mut` to make it mutable; the message can be changed too, to mention that it should be `shared` too
b.m() // no checker error, but it is better to have one, similar to the `f(a)` case above
from v.
Yes, we should add a checker error.
from v.
I've removed shared receivers from V. Passing tests, will be live soon.
from v.
(as discussed on discord)
from v.
Related Issues (20)
- mysql bug on macosx
- parser crash, discovered through radamsa HOT 6
- parser panic for reaching eof too many times, discovered through radamsa
- V parser panic, discovered through radamsa, when using `cmd/tools/measure/parser_speed` HOT 1
- V parser segfault with `v -silent bug6.v`, discovered through radamsa HOT 2
- V parser segfault with `-silent`, discovered with radamsa, for a very long `-----n----m------` pattern. HOT 1
- can not use generic lambda expression as parameter to generic function over 2 generic types
- Failed to compile C2V HOT 7
- Support splitting Strings into Unicode Grapheme Cluster
- Regex module ignores ^ and $
- compile of tvintris.v failed HOT 11
- Test failed on OpenBSD for vlib/os/os_stat_test.v HOT 1
- Test failed on OpenBSD for vlib/net/http/server_test.v
- Build fails on OpenBSD with clang and cstrict compilation HOT 3
- Map of fixed array initialisations HOT 4
- veb: parallel event loop HOT 5
- struct embedding must be declared at the beginning of the struct body HOT 2
- `coroutines` stuck whole program
- Can't add same element to cleared map HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v.