deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 272 seconds]
_whitelogger has joined #crystal-lang
<lunarkitty7>
Does crystal run on arm well?
<lunarkitty7>
seems like it would be a good fit for rubyesque embedded stuff
<lunarkitty7>
Though for my usage ruby is fast enough too
<lunarkitty7>
Or I could be non wasteful and use C++ on bare metal arm or atmel, just suffer a little :p
hightower3 has quit [Ping timeout: 244 seconds]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 244 seconds]
f1reflyylmao has quit [Ping timeout: 240 seconds]
f1refly has joined #crystal-lang
<FromGitter>
<ianmaxwell> is it possible to specify constructor args to be optional (and thus initialized with nil)? ⏎ `def initialize(@value : String, @left : Node, @right : Node)` so that left and right don't always have to be passed in?
<FromGitter>
<ianmaxwell> overloaded constructor would definitely work, but wondering if there is a slimmer option
<lunarkitty7>
ianmaxwell, yes, I think you want `def initialize(@value : String?, @left : Node?, @right : Node?)` (note the question marks)
<FromGitter>
<ianmaxwell> that was it. thanks @lunarkitty7
psydroid has quit [*.net *.split]
skrzyp has quit [*.net *.split]
snapcase has quit [*.net *.split]
bougyman has quit [*.net *.split]
psydroid has joined #crystal-lang
skrzyp has joined #crystal-lang
bougyman has joined #crystal-lang
snapcase has joined #crystal-lang
<FromGitter>
<grkek> Aw thats really nice of you raz
<raz>
grkek: i'm just sad cause i don't have a good native app idea atm. but very much looking forward to the next one :D
<raz>
i abandoned quite a few in the past just cause there was no reasonable way to write a GUI without diving into ObjC hell
<FromGitter>
<grkek> Do you like the idea of IU
<raz>
if by idea you mean "usable GUI shard in crystal" then what's not to like?
lunarkitty7 has quit [Ping timeout: 244 seconds]
alexherbo2 has joined #crystal-lang
<oprypin>
was there any way in crystal to interpret strings like "\x55" at runtime? i.e. the input is "\\x55" and the output is "U"
<FromGitter>
<dscottboggs> damn it. I'm trying to solve a practice problem and it expects an arbitrary number of values to be passed to the constructor and then transformed and passed to a callback
<FromGitter>
<dscottboggs> the tests only check for one or two so I guess I'll just do a simple union
<FromGitter>
<Blacksmoke16> do they have to be ivars?
<FromGitter>
<dscottboggs> what do you mean? I don't think so
<FromGitter>
<j8r> because Array is dynamic maybe?
<oprypin>
yea actually.. the `realloc` can break it
<FromGitter>
<j8r> Tuple could have, but probably not used enough
<FromGitter>
<j8r> to be worth it
lunarkitty7 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Client Quit]
<FromGitter>
<Qard> Is there some reason why the `Enum` type doesn't have a `to_unsafe` method that returns `value`? Seems to me like an obvious thing to do. 🤔
<FromGitter>
<Blacksmoke16> wouldnt that just be `.value`?
<FromGitter>
<dscottboggs> well yes, but having `#to_unsafe` aliased to `#value` would improve ergonomics when dealing with C APIs
<FromGitter>
<Qard> Yeah, that's my thinking.
<FromGitter>
<Blacksmoke16> but is it actually unsafe?
<FromGitter>
<Blacksmoke16> not really?
<FromGitter>
<dscottboggs> I mean, kind of
<FromGitter>
<Qard> I'm working with a C API right now that maps a bunch of C enum stuff to Crystal enum, but you can't pass the values directly into the lib functions, you need to add `.value` after everything, which is easy to miss and gives really unhelpful errors.
<FromGitter>
<dscottboggs> C is only seeing the value not the name, so you have to rely on the programmer to "get it right" which is usually what unsafe means...kinda
<FromGitter>
<Blacksmoke16> if anything wouldnt a feature that allows you to pass an enum to a c func and it do that under the hood?
<FromGitter>
<Blacksmoke16> be better*
<FromGitter>
<Qard> Even if you use `: Type` to tell it the values in the enum are of a particular type, it still doesn't work without using `.value`.
<FromGitter>
<Blacksmoke16> id maybe suggest that as a feature?
<oprypin>
Qard, why dont u bind the C function as accepting that enum type
<FromGitter>
<Qard> Which I guess worked at some point? But it doesn't now.
<oprypin>
whats the actual problem
<FromGitter>
<Qard> It uses stuff from that `Parameter` enum directly in a bunch of places, which doesn't work because it thinks the type is wrong.
<oprypin>
also why are you using a 3 years not updated repo
<FromGitter>
<Qard> Because it's a lot of code, and it *would* work other than the `.value` issue.
<FromGitter>
<Qard> It's not too hard to fork and find/replace, but it seems like the code must have worked at some point but doesn't now, and in looking at the code it seemed to me like something that *should* work.
<FromGitter>
<dscottboggs> I think you need to fork and take on maintainership of that shard if you intend to use it
<FromGitter>
<Blacksmoke16> maybe you had to do `.value` 3 years ago but the feature of typing an arg to an enum made it so you dont need to do that
<FromGitter>
<dscottboggs> yeah, 3 years is a long time ago in the Crystal timeline. It wouldn't surprise me if something changed.
<FromGitter>
<Qard> Sure, I'd expect some changes. Just seems to be like a feature I'd want to *keep*.
<FromGitter>
<Qard> Thus asking if there was some particular *reason* why it doesn't work that way anymore.
<oprypin>
Qard, could you post the error message? with --error-trace? i'm curious
<FromGitter>
<dscottboggs> yeah, this feels like a valid thing to raise in a github issue or forum post (where the core maintainers pay more attention)