ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
teardown has quit [Read error: Connection reset by peer]
teardown has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> ... promising direction, that’s just not what it’s designed for. I guess I was just hoping there was a GUI toolkit I wasn’t aware of that was easier to make bindings for than GTK, or something being developed a little more actively I had somehow missed being aware of. Oh well.
<FromGitter> <meltheadorable> @kalinon yeah I mentioned those above when I asked the question, the pure crystal one is over top of SFML which is a choice I’d consider to be questionable, I took a peek at the github link, they’re all either LibUI, Hedron (which is LibUI), or SFML, except for the one providing X11 bindings which is….linux only 😂 Will keep an eye on things, but I don’t think any of the SFML ones are a
<FromGitter> <meltheadorable> (the cocoa one is just providing a cocoa-ish API over top of libui, it’s not actually binding cocoa)
teardown has quit [Read error: Connection reset by peer]
teardown has joined #crystal-lang
<FromGitter> <watzon> Yesterday I proposed the idea of a cross platform gui framework based on Flutter. It would take a lot of work and some serious finessing, but could you imagine?
<FromGitter> <watzon> And by cross platform I mean completely cross platform, with multiple potential backends for OS's (Windows, Mac, and Linux), the browser, and the terminal
<FromGitter> <meltheadorable> i’m not sure how to feel about flutter yet
<FromGitter> <watzon> Personally I love it
<FromGitter> <meltheadorable> what’s exciting about it?
<FromGitter> <watzon> Well it makes cross platform app development extremely easy without giving up a lot of performance. I like Dart as a language and I like the way the UI development is done, all in code rather than abstracting everything out into a markup language of some kind. It makes the whole development process fairly painless by providing tools to debug and test your application, as well as providing hot reloading so that
<FromGitter> ... you can test on your device in real time.
<FromGitter> <meltheadorable> hrm
<FromGitter> <watzon> Only thing I don't like is that with Android builds you do still have to use Gradle which is more memory hungry than Chrome
<FromGitter> <meltheadorable> I dunno...
rohitpaulk has joined #crystal-lang
<FromGitter> <meltheadorable> i suppose cross platform app development is globally too difficult
<FromGitter> <watzon> Yeah it's a pain in the ass
<FromGitter> <watzon> Maintaining multiple codebases for the same app is stupid
<FromGitter> <meltheadorable> is there a UI builder or is it like, legitimately all dart code?
<FromGitter> <watzon> For now it's legitimately all dart code, although I do remember seeing a project that was a ui builder
<FromGitter> <watzon> I don't remember what it was called though
<FromGitter> <meltheadorable> anything unofficial will probably never be good enough
<FromGitter> <watzon> Probably not
<FromGitter> <meltheadorable> i feel like there’s historically been good reasons for splitting a UI into a markup/specification language and a behavioral language
return0e_ has joined #crystal-lang
<FromGitter> <meltheadorable> what’s gained from going dart all the way down?
<FromGitter> <watzon> I feel like their reasoning for not doing that in Flutter is sound. With markup languages you lose a lot of the expressiveness that code provides. Flutter has also done a really good job of making it so you don't miss markup languages. I did at first, and then I realized how powerful it was to just use pure dart
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <watzon> One of the same reasons I love the Lucky Framework in Crystal
<FromGitter> <watzon> They use crystal as a templating language almost
return0e has quit [Ping timeout: 245 seconds]
<FromGitter> <meltheadorable> Yeah, that gave me pause there too
<FromGitter> <watzon> You learn to love it
<FromGitter> <watzon> Seriously it's great
<FromGitter> <meltheadorable> I mean, *I* might like it, but I also have zero frontend expertise, I feel like kneecapping my team members, especially frontend designers & devs, by removing the tools they’ve developed expertise in because I don’t wanna learn how to use them properly is a losing strategy
<FromGitter> <watzon> Yeah it definitely has to be a team decision with something like that
<FromGitter> <meltheadorable> I also am fully willing to posit that markup languages are not ideal for UI specification — I’m *super* skeptical that general-purpose programming languages are either — like if we’re going back to the drawing board, I’d be really interested in like, actually designing the entire language around that problem with a really clear idea as to the use cases, or considering whether text-based
<FromGitter> ... programming environments are appropriate to the problem at all
<FromGitter> <watzon> I feel like Flutter's approach is at least a step in the right direction
<FromGitter> <watzon> No XML = Happy Chris
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
absolutejam2 has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter> <fernandes> @andrius glad it helped heheh
absolutejam2 has quit [Ping timeout: 248 seconds]
sorcus has joined #crystal-lang
ht_ has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> Crystal shards is down
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
alex`` has quit [Ping timeout: 246 seconds]
absolutejam2 has joined #crystal-lang
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
waheedi has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 244 seconds]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
ht_ has quit [Quit: ht_]
ht_ has joined #crystal-lang
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 268 seconds]
<FromGitter> <girng> up now'
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
_whitelogger has joined #crystal-lang
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
lucasb has joined #crystal-lang
<FromGitter> <girng> how to convert string to symbol
<FromGitter> <Blacksmoke16> string in a variable or a static string?
<FromGitter> <girng> for example `.colorize(:yellow)` but i have a list of all the ansci colors in a string array
<FromGitter> <girng> and want to pass `yellow` in
<FromGitter> <Blacksmoke16> then just pass the string?
<FromGitter> <girng> but i'm picking a random index from the array
<FromGitter> <girng> make it colorful
<FromGitter> <Blacksmoke16> so?
<FromGitter> <girng> i tried to pass it in
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d347234b2db751daba34d1d]
<FromGitter> <Blacksmoke16> just do like
<FromGitter> <girng> instead of using my own
<FromGitter> <Blacksmoke16> `.colorize(Colorize::ColorANSI.values.sample(1).first`
<FromGitter> <girng> wtf interesting
<FromGitter> <girng> O_O https://crystal-lang.org/api/0.29.0/Enum.html#values%3AArray%28self%29-class-method
<FromGitter> <girng> i facking read right past that
<FromGitter> <Blacksmoke16> :p
<FromGitter> <girng> wait wtf does sample do
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.29.0/Array.html#sample%28n%3AInt%2Crandom%3DRandom%3A%3ADEFAULT%29-instance-method
<FromGitter> <girng> so what's the diff between that and shuffle
<FromGitter> <Blacksmoke16> that picks out n random elements and returns them in an array
<FromGitter> <Blacksmoke16> shuffle just randomizes the order of the array
<FromGitter> <girng> eh
<FromGitter> <Blacksmoke16> ah looks like you dont need the `(1).first` then
<FromGitter> <girng> why does this even work
<FromGitter> <girng> it's not :color
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d3474508fe53b671db0383c]
<FromGitter> <girng> it's literally `LightMagenta`
<FromGitter> <girng> is that not a string, wtf
<FromGitter> <girng> i'm using pp, it should tell it's not a string
<FromGitter> <girng> and specify the typeof
<FromGitter> <Blacksmoke16> its an enum member of type `Colorize::ColorANSI`
<FromGitter> <Blacksmoke16> which there is an overload that allows any "color" enum to be used
<FromGitter> <girng> so Symbols are the :color, which is 1 overload way, and the other way, is passing the enum Color in it
<FromGitter> <Blacksmoke16> yes
<FromGitter> <girng> okay makes sense
<FromGitter> <Blacksmoke16> dont quote me on this, but im pretty sure when you do like `:red` the compiler actually resolves that into the enum member
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/79k9
<FromGitter> <girng> i'm glad i'm fiddling around with this crystal chat server 5000 project
waheedi has quit [Quit: waheedi]
<FromGitter> <girng> i'm learning while i'm having fun
<FromGitter> <Blacksmoke16> good to hear
<FromGitter> <girng> can enums be used for properties in classes
<FromGitter> <girng> ..l etme check
<FromGitter> <Blacksmoke16> sure
<FromGitter> <Blacksmoke16> enums are the preferred way to handle specific sets of values
<FromGitter> <girng> i am messing with them now
<FromGitter> <Blacksmoke16> as you get type safety, enumerable methods, can define your own methods etc
<FromGitter> <girng> seems like a tuple but with names?
<FromGitter> <girng> i kinda like it so far, gonna mess with it some more
<FromGitter> <Blacksmoke16> i think its essentially the same thing as a symbol in ruby
<FromGitter> <Blacksmoke16> a named int value
<FromGitter> <girng> they mutable?
<FromGitter> <Blacksmoke16> no?
<FromGitter> <girng> i can't seem to change the value
<FromGitter> <Blacksmoke16> you cant
<FromGitter> <girng> what am i doing wrong
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/79kr
<FromGitter> <Blacksmoke16> need to assign the property to a specific type within that enum
<FromGitter> <Blacksmoke16> vs the class
<FromGitter> <girng> eh
<FromGitter> <girng> i like tuples
<FromGitter> <girng> better
<FromGitter> <Blacksmoke16> or like `p.char_img = CharacterImage::Belt`
<FromGitter> <Blacksmoke16> :enu
<FromGitter> <girng> Or, namedtuples
<FromGitter> <Blacksmoke16> 😐
<FromGitter> <Blacksmoke16> why?
<FromGitter> <girng> i mean this looks way too verbose to store a simple value
<FromGitter> <girng> and redundant af
<FromGitter> <girng> and i can't even change the value
<FromGitter> <girng> like what the fack
<FromGitter> <Blacksmoke16> its meant to store static lists of values
<FromGitter> <girng> why store them if ic an't change them lol
<FromGitter> <Blacksmoke16> because you're not supposed to
<FromGitter> <Blacksmoke16> think of the `Color` enum
<FromGitter> <girng> static values then
<FromGitter> <girng> enum is for static data?
<FromGitter> <girng> immutable
<FromGitter> <Blacksmoke16> yes, example begin like
<FromGitter> <Blacksmoke16> ```enum Status ⏎ Active ⏎ Inactive ⏎ Pending ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d34782e8285d81daa34c261]
<FromGitter> <Blacksmoke16> where an obj would have *one* of those statues at a time
<FromGitter> <girng> well, then using it for my use case would be wrong, my apologizes. cause the char img should be mutable
<FromGitter> <girng> bad example by me
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <meltheadorable> Wait — is the list of options mutable or just the image being used by the character?
<FromGitter> <Blacksmoke16> because you can change the value of your `char_img` to a different enum member
<FromGitter> <meltheadorable> Yeah — thats what I was driving at — the property is mutable, just not the list
<FromGitter> <Blacksmoke16> just not change the actual list
<FromGitter> <Blacksmoke16> ^
<FromGitter> <meltheadorable> If the list is also mutable I think you just want an array held by some kind of higher level state that your characters will have access to
<FromGitter> <meltheadorable> that you can load options into
<FromGitter> <girng> is there an alternative to `pp` that shows the typeof
<FromGitter> <Blacksmoke16> `p!`?
<FromGitter> <meltheadorable> I’m currently feeling vaguely proud of myself because I’ve managed to extremely hackishly bind a native webview in crystal
<FromGitter> <Blacksmoke16> er no
<FromGitter> <girng> @Blacksmoke16 actually, that works 4 me
<FromGitter> <girng> @Blacksmoke16 it shows what they are gonna be
<FromGitter> <Blacksmoke16> ok
<FromGitter> <girng> thanks i like `p!`
<FromGitter> <meltheadorable> This does not help me for the main project I need a GUI for, but native webviews might be good enough for wrapping future webapps with
<FromGitter> <Blacksmoke16> 👍 nice one
<FromGitter> <girng> @Blacksmoke16 it seems like, when stuff is printed in the console, it's fair to see that Integers and Symbols (or enums) are NOT printed using "'s
<FromGitter> <meltheadorable> I dunno if i’m going to bother trying to figure out how to put that correctly into some kind of library
<FromGitter> <girng> But strings will always be wrapped with quotations, correct
<FromGitter> <girng> <using `pp`>
<FromGitter> <Blacksmoke16> sure
<FromGitter> <meltheadorable> at least not for now, but im excited i got it working
<FromGitter> <Blacksmoke16> some progress is better than none
<FromGitter> <meltheadorable> the C library I wrapped is currently being rewritten and I was only able to get it working with the old version, not the new one, so it seems like it might be a big waste of time to put the effort into trying to package it up nice until the original author is done :P
<FromGitter> <girng> what c library you using @meltheadorable
<FromGitter> <meltheadorable> https://github.com/zserge/webview
<FromGitter> <meltheadorable> i also didn’t bind the whole library yet, just the simplest invocation
rohitpaulk has joined #crystal-lang
<FromGitter> <girng> i'm aobut finished with this crystal chat server 5000 project. but notsure if i should host it officially on a site when i release it on github
<FromGitter> <girng> it's telnet based and needs a server
<FromGitter> <girng> although, you can modify fake_friends.txt and run it locally
rohitpaulk has quit [Remote host closed the connection]
devil_tux has quit [Ping timeout: 268 seconds]
alex`` has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
absolutejam2 has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 245 seconds]
waheedi has joined #crystal-lang
absolutejam2 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
waheedi has quit [Quit: waheedi]
absolutejam2 has quit [Ping timeout: 245 seconds]
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter> <HCLarsen> Hey folks, long time no see.
<FromGitter> <Blacksmoke16> o/
waheedi has joined #crystal-lang
alex`` has quit [Ping timeout: 258 seconds]
alex`` has joined #crystal-lang
absolutejam2 has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> so, what's the dealio with static linking an macOS?
<FromGitter> <absolutejam_gitlab> I see that the static build process for LInux should be run in an Alpine container. fair enough.
<FromGitter> <Blacksmoke16> mac doesnt support static linking
<FromGitter> <absolutejam_gitlab> so, what's required on the target system?
<FromGitter> <absolutejam_gitlab> Is this the same for the likes of Golang?
<FromGitter> <absolutejam_gitlab> It's just an OS limitation?
<FromGitter> <Blacksmoke16> probably?
<FromGitter> <absolutejam_gitlab> Is it XCode that's required?
<FromGitter> <tenebrousedge> darwin
<FromGitter> <tenebrousedge> seems like a bad idea to try
<FromGitter> <absolutejam_gitlab> huh?
<FromGitter> <absolutejam_gitlab> Oh, I mean for a dynamically-linked version
<FromGitter> <tenebrousedge> looks like you can install through `brew`
<FromGitter> <absolutejam_gitlab> but if the target didn't have Crystal installed
<FromGitter> <absolutejam_gitlab> would the binary work?
<FromGitter> <tenebrousedge> I'm pretty sure that's the idea, yeah
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter> <Blacksmoke16> @asterite Do you have any ideas on how to handle processing larger non JSON inputs for the streaming stuff? Currently I can get the larger files to work, but some things fail with a `parse error: Unfinished string at EOF at line 1, column 65536` since im im thinking jq is trying to process input that isnt fully converted yet?
<FromGitter> <Blacksmoke16> but i dont think i can *wait* until its done, otherwise i would fill the buffer again?
waheedi has quit [Quit: waheedi]
waheedi has joined #crystal-lang
<oprypin> Blacksmoke16, what.. things should just work, maybe provide a real example
<FromGitter> <Blacksmoke16> sorry, was based on some previous context
<FromGitter> <Blacksmoke16> i can make one, sec
ht_ has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> so currently if you give it non JSON input, it'll just hang. likely since the buffer on `IO.pipe` filling up, and not being processed
<FromGitter> <Blacksmoke16> large non JSON input*
<FromGitter> <Blacksmoke16> so to get around that i was doing the conversion in a fiber, but im thinking that causes issues when jq is reading the input
<FromGitter> <asterite> @Blacksmoke16 I'm not sure. I didn't see any `spawn` in your code so I was surprised it worked... does it work at all?
<FromGitter> <Blacksmoke16> sec, i didnt push it yet
Groogy has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> which works for the larger input file, but another jq operation on another file breaks with that unfinished string error
<FromGitter> <Blacksmoke16> but im out of my element getting into fibers plus IOs now
<FromGitter> <asterite> yes, sorry, I don't know much about that either
<FromGitter> <asterite> I learned that you need spawn and that IO.pipe likely uses a small buffer from waj
<FromGitter> <Blacksmoke16> i also get ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ from the larger file [https://gitter.im/crystal-lang/crystal?at=5d34d6dae2d1aa6688e6b911]
<FromGitter> <Blacksmoke16> so something prob isnt quite right
<oprypin> Blacksmoke16, maybe u just need to `flush` after writing?
<oprypin> cuz it does end up being https://crystal-lang.org/api/0.29.0/IO/Buffered.html BUFFER_SIZE = 8192
<oprypin> hm no, that would make little sense. i think you're doing everything right, anyway
<oprypin> i remember, though, that in python there were always problems with double piping
<FromGitter> <Blacksmoke16> i still get the unfinished string error even if comment out the output portion of it
<oprypin> yeah i think this just might be it
<FromGitter> <Blacksmoke16> hmm
<oprypin> so i think what it boils down to, your program is not allowed to do an action that amounts to "read all of the program's output" without an explicit action indicating to the program's that the *input* is finished
<FromGitter> <Blacksmoke16> that could be it, pretty sure bot the files are over 65k
<oprypin> maybe there has to be an `input_read.close` somewhere
sorcus has quit [Ping timeout: 250 seconds]
<FromGitter> <asterite> I think the spawn for the output must come before the other bit
<FromGitter> <asterite> sorry, on cellphone
<FromGitter> <asterite> move second spawn right after io pipe
<FromGitter> <Blacksmoke16> same
<FromGitter> <asterite> otherwise output write will be full
<FromGitter> <asterite> strange
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d34db49b2db751daba623b4]
<FromGitter> <Blacksmoke16> even skipping the output processing, so must be with between deserializing the passing the input to jq
<FromGitter> <asterite> I mean, for output, that seems to be input
<FromGitter> <asterite> ah, nevermind
<FromGitter> <Blacksmoke16> yea, issue still happens if you have jq output directly to stdout
<FromGitter> <Blacksmoke16> changing it to process.run seems to fix it, without output processing at least
<FromGitter> <Blacksmoke16> fml if thats all i had to do
<oprypin> well no, output processing is the thing if i had to guess
<oprypin> but i guess changing to process.run also has a potential of a workaround
<FromGitter> <Blacksmoke16> yea now its getting stuck on the output i think
<FromGitter> <Blacksmoke16> since .run makes it wait to finish its filling up the output_write buffer and blocking
<FromGitter> <Blacksmoke16> oo think i figured it out
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d34dec3808425671cc50fd4]
<FromGitter> <Blacksmoke16> something like that seems to work for both cases
<FromGitter> <Blacksmoke16> and specs pas
<FromGitter> <Blacksmoke16> still get ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ so :shrug: [https://gitter.im/crystal-lang/crystal?at=5d34df05d1cceb1a8d9ad894]
<FromGitter> <Blacksmoke16> ill take it, thanks for the help
<FromGitter> <rvprasad> Building the crystal compiler on Rasp Pi 3B fails runs out of memory. So, does anyone know the memory requirements of a machine to compile crystal compiler?
<FromGitter> <Blacksmoke16> A good amount
<FromGitter> <Blacksmoke16> prob at least 2 gigs?
<FromGitter> <Blacksmoke16> based on my quick test
<rkeene> You can just cross-compile it
woodruffw has joined #crystal-lang
<FromGitter> <rvprasad> @Blacksmoke16 If this is true, then crystal cannot be compiled on Rasp Pi <=3B+.
<FromGitter> <Blacksmoke16> prob an accurate fact
<FromGitter> <watzon> There's a lot of things you can't do with a device that has 1GB or RAM
<FromGitter> <rvprasad> @FromIRC Cross compiling the crystal compiler object file on Ubuntu and linking it on Rasp Pi fails results in a "broken" behavior -- https://github.com/crystal-lang/crystal/issues/7978.
<FromGitter> <rvprasad> @watzon While I agree with that view in many cases, I am surprised it is true in this case. Specifically, I am not sure if it is a bug in the cross-compiled bootstrap compiler or the code for crystal is indeed so complex/big that it needs more than 1GB to be compiled.
<FromGitter> <watzon> The second one. Compiling on my machine takes more than 1GB regularly. If I remember right it caps out over 2GB.
waheedi has quit [Quit: waheedi]
<FromGitter> <asterite> Also, if cross-compiling doesn't work then compiling it on the machine itself won't work either. There's probably something else going on (incorrect C bindings or asm fiber code not correct, I don't know)
absolutejam2 has quit [Ping timeout: 258 seconds]
<FromGitter> <rvprasad> @asterite I tried compiling on RaspPi to check if the issue was with cross compilation. But, no luck :(