vlang / ved

1 MB text editor written in V with hardware accelerated text rendering. Compiles in <1s.
GNU General Public License v3.0
1.34k stars 78 forks source link

discussion: why not make the things safe instead of marking them unsafe? #178

Open heavyk opened 2 months ago

heavyk commented 2 months ago

it seems to me that I'd like to make abstractions which remove the need to type "unsafe" -- thereby making it safe, or acceptable.

to challenge myself, I decided to open the 2048 example and go through that...

gg          &gg.Context = unsafe { nil } // perhaps 'uninit' instead?

nevermind ... so disclaimer here, I've never programmed v before, and I have no idea really. this just looked like a fun discussion to put. I'm sure there are many other great solutions.