<FromGitter>
<girng> but, if i do crystal build test.cr --release, and then just xfer that executable to a fresh installation of debian. can i stil run it? or do i still need to re-install all the crystal dependencies, etc, etc?
<FromGitter>
<bew> you'll just need your test program dependencies
<FromGitter>
<bew> type in `ldd <executable>` to see the needed libraries
<FromGitter>
<girng> if you do `b : Int32 | String` sum(12, 20) it works, but nothing get printed
<FromGitter>
<girng> oh, return
<FromGitter>
<girng> type
<FromGitter>
<girng> thank you
<oprypin>
strange that crystal slowed down in the last week, i'd expect asterite's contributions to reinvigorate the community
<Yxhuvud>
perhaps people are waiting for them to appear in a released version
<FromGitter>
<girng> well i got depressed a couple days ago after reading that 1 post in gitter
<oprypin>
that's not the word you're looking for
<FromGitter>
<girng> it really is. i don't like to read about people leaving crystal. it makes me sad, thus, less motivation of me to code, which in terns makes me depressed
<FromGitter>
<manveru> only thing i'm missing atm for crystal is a better out-of-the-box experience for macos
<oprypin>
never heard of anything wrong with it on macos
<oprypin>
like all main devs used macos
<FromGitter>
<manveru> it's just that i spent half an hour with a coworker trying to get a server to build
<FromGitter>
<girng> why is macos so popular in dev community?
<FromGitter>
<manveru> it couldn't find libssl for some reason
<oprypin>
if u want a good experience, u use arch linux
<FromGitter>
<manveru> i blame DHH
<FromGitter>
<girng> LOL
<oprypin>
i'm not even joking
<FromGitter>
<girng> Windows + WSL > all
<oprypin>
larger? probably
<FromGitter>
<girng> i'm not even joking
<FromGitter>
<girng> 😆
<FromGitter>
<manveru> Nix works anywhere, and i'm on NixOS anyway :)
<FromGitter>
<manveru> used arch for years though
<FromGitter>
<manveru> but once i tasted declarative system configuration with deterministic builds of all the things... it's kinda hard to go elsewhere
<FromGitter>
<manveru> got a macbook from work, which i only touch when we have to use their proprietary meeting software, the window management alone makes me wanna cry
<FromGitter>
<girng> macbook has a class action lawsuit right now over their butterfly keyboards
<FromGitter>
<girng> Apple*
<FromGitter>
<manveru> hehe
<FromGitter>
<girng> wouldn't touch them with a pole infused with golang
<FromGitter>
<girng> stay far away
<FromGitter>
<manveru> yeah, we had several cases of keys being broken :P
<FromGitter>
<manveru> i just introduced golang too...
<FromGitter>
<girng> yeah, and reparing them is a PITA too. they are riveted inside the board. andyou have to take off the battery and other components.
<FromGitter>
<girng> it's ridiculous
<mps>
macos is just good marketing, nothing more
<FromGitter>
<manveru> it's kinda ridiculous how important marketing is to get people to adopt something
<FromGitter>
<manveru> speaking of which, who markets crystal?
<mps>
and successful marketing needs a stupidity of the consumers
<mps>
best marketing is quality, so I hope that crystal will devs will be concentrated to the quality
<mps>
and, we (other) on the building ecosystem around it
<FromGitter>
<manveru> aye
<FromGitter>
<manveru> i just deployed my first crystal app, but it's just an internal dashboard thingy
<FromGitter>
<girng> i feel really spoiled after coding in crystal now lol i can't try out any new language
<FromGitter>
<girng> i just stop, and go back to crystal
<FromGitter>
<girng> i tried nim, elixir, and golang
<FromGitter>
<manveru> most of my dayjob is still ruby and golang
<FromGitter>
<manveru> i'm trying to introduce some elm for frontend stuff
<FromGitter>
<manveru> really just tired of runtime errors after 2 decades of dealing with this insanity
<mps>
i'm conservative in selecting new thechnology to use, but with crystal I jumped in it on the first look
<FromGitter>
<girng> golang = syntax is very confusing, tcp chat room example is far too robust, arthritis from camel case ⏎ nim = i like the syntax, but tcp example is too confusing for me. iuno what {...} means all over the place ⏎ elixir = syntax is great, but functional. i like OOP, my brain can't wrap around functional paradigms. it jsut doesn't i already tried. spent a whole week getting a tcp server in elixir working with
<mps>
it took me two years (about) to start golang and never have good feeling with it despite my deep roots in C
<mps>
now, when I know just little about crystal I stopped to work with golang
<FromGitter>
<manveru> afaict concurrency is still worlds better in golang
<FromGitter>
<manveru> but you have to deal with nils all over the place
<FromGitter>
<manveru> plus interface{} for even minor things like JSON parsing
<FromGitter>
<manveru> if i have to deal one more time with a `map[interface{}]interface{}` from YAML...
<mps>
manveru: yes, it is but crystal is in the alpha stage, so it will improve, i hope
<FromGitter>
<girng> @manveru wat is t hat
<FromGitter>
<girng> looks like spaghetti code
<FromGitter>
<girng> and arn't brackets supposed to be encapsulated is that valid golang?
<FromGitter>
<manveru> it's valid
<FromGitter>
<manveru> it just means that the map key/value can have any type
<FromGitter>
<manveru> and you have to assert those, which may lead to panics if you do it wrong
<FromGitter>
<manveru> i still prefer go to ruby for production stuff, fwiw, at least you can do *some* static typing
<FromGitter>
<manveru> and you can teach it to people in 1-2 days
<oprypin>
you cant be serious
<oprypin>
you can teach how the language works maybe, but not how to actually get anything real done with it
<FromGitter>
<manveru> i'm pretty serious, as i've done that before a few times
<FromGitter>
<manveru> of course you have to teach them more in code reviews and give them a nice editor with completion, but it's not too hard
<FromGitter>
<girng> have you taught crystal?
<FromGitter>
<manveru> not yet
<FromGitter>
<manveru> i used crystal last maybe 2 years ago, and it was too unstable
<FromGitter>
<manveru> just got into it again last week
<FromGitter>
<girng> do you have to get it added to the curriculum through the school district, or can you just manually teach it / make it part of your course whenever u want?
<FromGitter>
<manveru> i'm a developer, not a teacher
<oprypin>
i dont think any school is involved here lol
<FromGitter>
<girng> @oprypin lol, well overmind is a professor so i thought maybe i found another 1
<FromGitter>
<manveru> :)
<FromGitter>
<manveru> anw, gotta do some more cleaning, bbl
<FromGitter>
<girng> aye, that's good marketing right there! 😆
<FromGitter>
<manveru> teaching crystal basics to rubyists should be even simpler
<FromGitter>
<manveru> until you get to meta-programming
<FromGitter>
<girng> macros?
<FromGitter>
<girng> oh god
rohitpaulk has quit [Ping timeout: 264 seconds]
<oprypin>
it's literally just a templating language
<mps>
yes, i'm learning crystal reading ruby book (found one free on net) and I don't know ruby
<Yxhuvud>
I think the first hurdle is more the 'Hey, why don't my code work, why do I get this error involving Foo | Nil ?
<FromGitter>
<girng> im learning crystal through gitter, am i doing it right
<mps>
but, it is easy
<oprypin>
girng, no
<mps>
just don't have enough free time to dive deeper
alex`` has quit [Ping timeout: 255 seconds]
<Yxhuvud>
It is easy, but it takes a while to get to the part where people don't have not_nil! on every line.
<oprypin>
girng, you may say i'm rude but really the rudest thing is valuing other people's time less than your own
<mps>
yes, some time is needed to switch to 'natural' style of the new language
<FromGitter>
<MrSorcus> > \`cmd code here\` ⏎ ⏎ I know about this. But it's not a similar to `proc-open`, i think. Thanks you anyway.
<FromGitter>
<ph055a_twitter> Hey everyone, I decided to take a look at crystal. I decided to go over learn ruby the hard way but write everything in crystal and see how far I can get before running into errors.
<oprypin>
ph055a_twitter, seems like a pretty bad idea
<FromGitter>
<ph055a_twitter> Why? not worth the time and effort?
<FromGitter>
<ph055a_twitter> Not really seeing much material on crystal
<oprypin>
ph055a_twitter, it is harmful to be in the mindset of a dynamic language when using Crystal
<FromGitter>
<ph055a_twitter> I'm coming from golang
<oprypin>
what you can do is learn ruby in a focused manner then forget about it and learn crystal
<oprypin>
but i think you'll be fine just going straight for crystal docs
<FromGitter>
<ph055a_twitter> ok thanks I'll take your advice thanks
<oprypin>
and when the inevitable ruby-specific omissions appear, ask here
<FromGitter>
<ph055a_twitter> ok
<FromGitter>
<4d47> what is the idiomatic way of providing a default when `value.empty?` I see Rails has method presence for something like this
hightower2 has quit [Ping timeout: 240 seconds]
<oprypin>
4d47, this is unclear to me
<oprypin>
4d47, if you want `""` to mean nothing, there is no shorthand for that. it's not unusual to use it as "nothing"
<oprypin>
sorry, I mean it IS unusual to use `""` as a substitute for `nil`
<FromGitter>
<jpincas> Quick question regarding project structure. The docs mention that the compiler looks in a 'lib' directory, but creating a project with `crystal init app` seems to create a structure without `lib`. Whats the recommended set up?
<FromGitter>
<Sija> @4d47 I think you meant `Object#blank?` extension
<FromGitter>
<Sija> there’s nothing like that in Crystal, but you can add it yrself
<FromGitter>
<Sija> @oprypin sometimes you'd want to handle `String?` case where `nil` and `””` should mean the same
<FromGitter>
<Sija> @jpincas `lib` directory is used for vendored code, usually installed as shards (see `dependencies` key in `shard.yml`)
<FromGitter>
<jpincas> @Sija Oh i see - so basically I should keep my own code in the `src`directory I suppose.
<FromGitter>
<Sija> yup, that’s correct
<FromGitter>
<jpincas> Ok so i see it has created a 'myapp' folder under 'src' as well as a 'myapp.cr'. What the significance of that? Is it like 'myapp.cr' is the 'main' file (I'm coming from Go) and the 'myapp' folder is where most of my logic should go?
<oprypin>
jpincas, I consider this structure harmful. just put whatever you want inside `src`
<FromGitter>
<Sija> mainly it’s up to you since Crystal’s “main” file is what you’ll give to it when compiling `crystal build src/myapp.cr` <- here `src/myapp.cr` acts as “main"
<FromGitter>
<Sija> but most used convention comes from Ruby, and it basically uses folders as namespaces
<FromGitter>
<jpincas> @Sija Is there anything about namespaces in the docs?
<FromGitter>
<jpincas> ok , yeah thats the page Im on
<FromGitter>
<jpincas> seems like you can pretty much do what you want in terms of code organisation theb
<crystal-gh>
[crystal] asterite closed pull request #6007: Don't leak variable name when assigning to ivar/cvar in method signature (master...feature/no-implicit-instance-var) https://git.io/vpc87
<FromGitter>
<Sija> it’s more about convention than any pre-specified structure
<FromGitter>
<mjago> Experimenting with binding Crystal to a Lua Library (LuaRadio). Linking to libluajit and libluaradio. Flow graph script is in Lua. Works well! https://github.com/mjago/libluaradio
<FromGitter>
<jpincas> Cool - i see that now. Just used to the package = folder structure that Go dictates I guess
<FromGitter>
<Sija> is @bcardiff back from holiday by any chance?
<FromGitter>
<Sija> I’d like to molest him some moar about crystal nightlies on travis :P
<FromGitter>
<Sija> being unable to test shards under nightlies is soooo frickin’ annoying
<oprypin>
you're not literally unable to do that
<oprypin>
could always compile crystal master
<FromGitter>
<Sija> they’re build at circleci as .deb packages, so why not?
<oprypin>
i'm not saying it's bad to have nightlies, i'm saying that "being unable" is not true because there is a way to do it
<FromGitter>
<Sija> and of course I CAN do that, but that’s not the point, adding `crystal: [stable, nightly]` to `.travis.yml` is bit easier for every1, don’t you think?
<FromGitter>
<Sija> yeah, that’s the thing, from my understanding it’s just one step from having those hooked up into travis
<FromGitter>
<Sija> and simplifying the process
<FromGitter>
<Sija> I’d love some1 from manas come forward and tell how far is that from reality
jeromegn has quit [Ping timeout: 256 seconds]
jeromegn has joined #crystal-lang
<oprypin>
it's a funny thing about travis. nobody really likes the way they offer their services, but hey, it's free hardware on which it's fine run potentially malicious code
ssvb has quit [Quit: Leaving]
<FromGitter>
<ph055a_twitter> whats is ```gets.chomp``` in crystal? don't see anything in the docs.
<Yxhuvud>
ph055a: String#chomp exist, just as in ruby. But gets can return nil, so you have to check for that.
<oprypin>
there's a double redirect in docs (see IO blah) but you end up seeing the kwargs here https://crystal-lang.org/api/0.24.1/IO.html#gets%28delimiter%3AChar%2Climit%3AInt%2Cchomp%3Dfalse%29%3AString%3F-instance-method
<FromGitter>
<ph055a_twitter> This all seems overly complicated way of getting user input
<oprypin>
how is `read_line(chomp: true)` complicated
<FromGitter>
<ph055a_twitter> gets.chomp
<FromGitter>
<ph055a_twitter> seems simple
<FromGitter>
<ph055a_twitter> I'll adjust
<oprypin>
you can use just `gets` but it's nillable
<oprypin>
`chomp: true` is default tho
<oprypin>
so just `read_line()`
<FromGitter>
<ph055a_twitter> ok
sherjilozair has joined #crystal-lang
<FromGitter>
<girng> im testing my gameserver on my vps: check screenshot (https://i.gyazo.com/13e886f2e8bad96640f52bb658133d5c.png), i loaded up 4,000 tcp connections. then disconnected them all. my memory at 12.0% usage. ⏎ however, when i run `netstat -ntu`, i get over 4000 lines of the connection, and it says "CLOSE_WAIT"
That_Guy_Anon has quit [Ping timeout: 276 seconds]
WA9ACE has quit [Ping timeout: 256 seconds]
WA9ACE has joined #crystal-lang
aarongodin has quit [Ping timeout: 256 seconds]
aarongodin has joined #crystal-lang
jetpack_joe has quit [Ping timeout: 256 seconds]
jetpack_joe has joined #crystal-lang
<FromGitter>
<forkev_twitter> @girng - Close_Wait may signify the process waiting for the closing acknowledgement of the connection from the client. check out https://stackoverflow.com/questions/15912370/how-do-i-remove-a-close-wait-socket-connection . I wonder if you can send the response and close at the same time. in your model, how long do anticipate needing the connection open?
<FromGitter>
<girng> well,i want it to be removed after its closed. thanks for link, i checked this: https://stackoverflow.com/a/17697733/7873241 but my vps is OpenVZ. it won't let me c hange the tcp timeout in sysctl
<FromGitter>
<girng> i guess, i would need a KVM vps or something, then use that setting and it should work, and the tcp connection will be removed from netstat?
<FromGitter>
<jpincas> Sorry for noob questions. Can you split method call arguments over multiple lines if you have quite a few of them? I've tried a few different combos, splitting before/after commas and the only way I can get it to compile is having them all on 1 line.
<FromGitter>
<forkev_twitter> hmm. all beyond me. I'll do some more reading on tcp timeouts. I always view the VPS hosts as a challenge and an exercise in how close I can g to what I need with their limitations baked in.
<FromGitter>
<jpincas> ok so brackets are optional for arguments when calling methods?
coderobe has joined #crystal-lang
<coderobe>
hey, how would i go about cross-compiling crystal for arm-linux-gnueabihf?
<coderobe>
my target device doesn't have enough rom for llvm itself hehe
<FromGitter>
<Sija> @jpincas yep, same as in Ruby
<FromGitter>
<jpincas> ht
wrq has quit [Quit: Connection closed for inactivity]
<FromGitter>
<jpincas> @Sija is there some exception for that rule for class constructors. I seem to get an `unterminated parenthesized expression` error when i try to add parentheses to `x.new (arg 1, arg 2)`?
<FromGitter>
<jpincas> whereas `x.new arg1 arg2` works
<FromGitter>
<Sija> there’s one space too much between the method name and opening parentheses
<FromGitter>
<Sija> `x.new(arg, …)`
<FromGitter>
<jpincas> i see - thanks
<FromGitter>
<jpincas> any tips at all on editor tooling (I use VsCode) - not working that well for me
andersh has quit [Remote host closed the connection]
<FromGitter>
<Sija> @jpincas vim has pretty decent support for crystal, AFAIK Atom has it too to some degree
<coderobe>
Sija: ah, my target is not a raspi but that'll work i guess, thanks!
* coderobe
just has to figure out how to build a smaller llvm now
andersh has joined #crystal-lang
<coderobe>
or maybe i can link it statically...
sherjilozair has quit [Remote host closed the connection]
johndescs has left #crystal-lang [#crystal-lang]
sherjilozair has joined #crystal-lang
sherjilozair has quit [Quit: Leaving...]
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
duane_ has joined #crystal-lang
<FromGitter>
<rodrigonbarreto_twitter> Guys, one question, exist some video course to crystal or lucky ?and What book are you guys recommend ?
rohitpaulk has joined #crystal-lang
<crystal-gh>
[crystal] asterite opened pull request #6104: Allow visibility modifiers without a target (similar to Ruby) (master...feature/visibility-without-exp) https://git.io/vphIn
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter>
<valamorgon> I have this error: undefined method 'content=' for Nil (compile-time type is (Topic | Nil))
<FromGitter>
<valamorgon> How can I handle nil values?
<FromGitter>
<valamorgon> crystal wont even compile because of possibility of nil values
<FromGitter>
<MrSorcus> > How can I handle nil values? ⏎ ⏎ possible_nil.try(&.call_method) ?
<Yxhuvud>
valamorgon: What do you want to happen if it is nil?
<FromGitter>
<valamorgon> @yxhuvud I wanted crystal to not to worry about possible nil values in compile time, I solved my problem following the link @faustinoaq provided
<Yxhuvud>
you will find crystal worries about nil, so that you don't have to do that during runtime.
<oprypin>
valamorgon, "crystal wont even compile because of possibility of nil values" -- correct, that's one of its best features
greengriminal has joined #crystal-lang
faustinoaq has joined #crystal-lang
Ven`` has joined #crystal-lang
<FromGitter>
<manveru> anyone got some examples of CLI tools written in crystal? wondering how to best do option parsing for subcommands and such (planning to simply use OptionParser for now)
<Yxhuvud>
less controversial than the one a few hours ago. I hope the former get merged - i prefer the ruby way of declaring visibility.
<oprypin>
:/
<Yxhuvud>
note that the current way in crystal works too - it is just that almost noone uses it as people think it is a better convention to group all public methods at the top.
<oprypin>
could someone point me to the code that "instantiates" methods (depending on input types)?
<Yxhuvud>
oprypin: please describe in more detail what you ask for.
<oprypin>
when i write `def f(x); x+x; end` and later f(5); f("a"); i would expect there to be f(int):int and f(string):string
<oprypin>
i want to tap into this information
<oprypin>
not in normal user code, but rather by hacking the compiler
<Yxhuvud>
I wonder if more people than @asterite knows that. someone at manas perhaps?
<oprypin>
i mean, it's probably not rocket science
<oprypin>
worst thing that could happen is that it's scattered all across the codebase
<crystal-gh>
[crystal] asterite opened pull request #6106: Fix: annotation check failure when other annotations are present (master...bug/missing-annotation) https://git.io/vphsC
<FromGitter>
<bew> Ah.. Have fun finding why?
<oprypin>
lol it's trivial `def collect_types(nil : Nil, target)` - change from nil to anything
<crystal-gh>
[crystal] ysbaddaden pushed 1 new commit to master: https://git.io/vphnF
<crystal-gh>
crystal/master 4b8159c Ary Borenszweig: Fix parsing of empty array with space/newline
<oprypin>
yes, this looks very promising
<oprypin>
cant be fully automated, of course, but with some heuristics and thorough review it can be something
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<bew> Nice idea! Maybe that could be used in a buildchain to ship almost fully typed shard for users, but don't have to type everything when you work on the shard itself