4 ms·
This compiles to C, which (I think) means it should be able to FFI to it fairly easily?
by tombert 8y ago
This compiles to C, which (I think) means it should be able to FFI to it fairly easily?
- amedvednikov 8y agoYes, calling C functions is as simple as C.puts('hello world')
- tombert 8y agoAh, cool, so effectively the standard library is huge :). Question though; I'm assuming that if you're touching C, there's no extra protection added by V, right? The C will be just as unsafe as it was before, or do you add some kind of exception handling thing around it?
- megous 8y agoWhere did you get an idea that the language has exceptions? Looks like they just have a way to return errors if you use question mark at the end of function declaration. See "Option types" here https://vlang.io/docs https://vlang.io/docs
- tombert 8y agoSorry, that's kind of what I meant, though I realize I made a mistake in how I said it.
- amedvednikov 8y agoNo extra protection right now. You have to handle error codes. Strings are simple: 'hello'.cstr() So are arrays: [1,2,3].carray() But if you work with pointers, you have to be careful. Maybe I'll implement an unsafe block.
- hexane360 8y agoHow can this be true if "V's memory management is similar to Rust but much easier to use"?