ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
mattt1 has joined #crystal-lang
mattt has quit [Ping timeout: 276 seconds]
void09 has joined #crystal-lang
<FromGitter> <tarbetu:matrix.org> Heya. Is there anyway to export crystal classes into Python?
<FromGitter> <Blacksmoke16> no
<FromGitter> <tarbetu:matrix.org> Can't Crystal export any bindings?
<FromGitter> <tarbetu:matrix.org> Oh, this was a short answer. :) Anyway, it seems crystal classes can be exported into ruby.
<FromGitter> <Blacksmoke16> in some cases yes, but usually no
<FromGitter> <tarbetu:matrix.org> But why?
<FromGitter> <Blacksmoke16> ```class Foo ⏎ def run ⏎ "foo" ⏎ end ⏎ end``` ⏎ ⏎ is valid Ruby and Crystal [https://gitter.im/crystal-lang/crystal?at=6134f9194c7be06b79a03252]
<FromGitter> <Blacksmoke16> but once you start adding type restrictions to things like: ⏎ ⏎ ```class Foo ⏎ def run : String ⏎ "foo" ⏎ end ⏎ end``` ⏎ ⏎ This is only valid Crystal [https://gitter.im/crystal-lang/crystal?at=6134f931d9a141754dd4a5de]
<FromGitter> <Blacksmoke16> because Ruby doesn't have that concept, so would be invalid Ruby syntax
<FromGitter> <Blacksmoke16> but by export i assume you mean copy/paste?
<FromGitter> <tarbetu:matrix.org> Oh, I mean the binding between this languages.
<FromGitter> <Blacksmoke16> officially Crystal only supports C bindings afaik
<FromGitter> <tarbetu:matrix.org> How about this project? https://github.com/Anyolite/anyolite
<FromGitter> <Blacksmoke16> i didnt say it was impossible, just that it's not an official feature of the lang. I.e. not built-in
<FromGitter> <Blacksmoke16> if there's a shard to do what you're wanting, that's great
<FromGitter> <jrei:matrix.org> Good luck trying to embed CPython :)
<FromGitter> <tarbetu:matrix.org> Oh, thanks anyway :) I would like to call Crystal methods from python.
<FromGitter> <Blacksmoke16> good luck ;P
<FromGitter> <jrei:matrix.org> However will be simpler probably with pypy or other alternative interpreters
<FromGitter> <Blacksmoke16> any reason you cant just use Crystal for everything? 😉
<FromGitter> <jrei:matrix.org> Would be too simple haha 😂
<FromGitter> <jrei:matrix.org> At least use Ruby :3
<FromGitter> <jfontan:matrix.org> You can make a crystal server and send RPCs to it from python or ruby
<FromGitter> <jrei:matrix.org> That'a good solution, I've done this with JavaScript <-> Crystal
<FromGitter> <jrei:matrix.org> Though it's best to auto generate message classes for both ends to avoid any errors
<FromGitter> <jfontan:matrix.org> grpc may be useful but I've never tried it with crystal
<FromGitter> <jrei:matrix.org> Does someone have an idea of what's going on here? https://carc.in/#/r/bvnb
<FromGitter> <Blacksmoke16> i think the interface expects there not to be any yielded args, while your implementation has 1
<FromGitter> <jrei:matrix.org> I see, strange: https://carc.in/#/r/bvnm
<FromGitter> <jrei:matrix.org> Remove the `self.` before the `a.`, still error.
<FromGitter> <jrei:matrix.org> Strange that module are less strict than class/structs
<FromGitter> <Blacksmoke16> well for one you cant have abstract class methods
<FromGitter> <jrei:matrix.org> yeah I know, but error still there in any case
<FromGitter> <jrei:matrix.org> ha ok for modules
<FromGitter> <Blacksmoke16> https://carc.in/#/r/bvnt
<FromGitter> <jrei:matrix.org> I should use ectend, forgot it
<FromGitter> <jrei:matrix.org> interfaces are really not ideal :/
<FromGitter> <Blacksmoke16> depends on the use case
<FromGitter> <jrei:matrix.org> If you want an interface which for class and instance methods, it becomes messy
<FromGitter> <Blacksmoke16> could have macro included hook on the interface that extends another class interface module :shrug:
<FromGitter> <jrei:matrix.org> probably... the API docs won't be as clear "Take case to also implement methods in X"
<FromGitter> <jrei:matrix.org> generics can also be used to some extent
<FromGitter> <Blacksmoke16> related https://github.com/crystal-lang/crystal/issues/5956
<FromGitter> <jrei:matrix.org> Thanks!
ur5us has joined #crystal-lang