IRC Logs for #circuits Thursday, 2015-10-08

*** koobs has quit IRC04:46
*** koobs has joined #circuits05:57
*** fUD has joined #circuits06:28
*** koobs has quit IRC06:42
*** koobs has joined #circuits07:42
*** Osso has joined #circuits08:50
*** Coldblackice_ has quit IRC12:26
*** koobs has quit IRC13:22
*** koobs has joined #circuits13:45
spaceoneOsso: hm? why doesn't python do interact with C well?18:10
*** Coldblackice_ has joined #circuits18:13
Ossospaceone: for instance when you are writing C extensions you need to wrap all your outputs in classes from CPython19:53
Ossosame problem with inputs19:54
spaceoneyes19:54
spaceoneof course19:54
Ossofor rust I don’t have to do that19:54
spaceonei don't know rust19:54
spaceoneso there is a internal mapping of datatypes in rust?19:54
Ossogo has garbage collection and can still handle c calls19:55
spaceoneand what if you give something like a dict to a c function in rust?19:55
Ossothere’s a libc::c_int and stuff you get19:55
spaceoneor if you pass more than the allowed arguments to a c function?19:56
spaceoneso you have to convert things by yourself?19:56
Ossomostly it’s just a cast away, the pointers are the same unless you want to bound checking which is still just one cast away19:56
spaceoneso how does that look?19:56
spaceonefoo = libc::c_int(15)19:57
spaceonemy_C_function(foo)19:57
spaceone?19:57
Ossoyou can do19:57
spaceonethis can be done as well in python19:57
Ossolet foo = 15; (which is would infer to a rust type)19:58
Ossomy_C_function(foo as libc::c_int)19:58
spaceonewell yes19:58
spaceonebut this is also possible with python19:59
spaceonepython has the advantage that you can write wrappers19:59
Ossoeven cffi it’s not that straight forward19:59
spaceonecffi?20:00
Osso(you still need to bindgen the stuff you are going to use rust)20:00
Ossofrom the c header files20:00
Ossothis https://cffi.readthedocs.org/en/latest/overview.html#simple-example-abi-level-in-line20:01
spaceoneimport ctypes; foo = ctypes.c_int32(15)20:01
spaceoneoh yes, i remember cffi20:01
Ossoor ctypes yeah20:01
*** sysanthrope has quit IRC22:00
*** sysanthrope has joined #circuits22:03

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!