ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
_whitelogger has joined #crystal-lang
pabs has quit [Ping timeout: 260 seconds]
pabs has joined #crystal-lang
snsei has quit [Remote host closed the connection]
duane has quit [Ping timeout: 248 seconds]
duane has joined #crystal-lang
<FromGitter> <CreationFox> Hi, I'm new to crystal. I keep seeing these things where they have a variable name in || symbols, for example, `|x|`. I can't find the documentation reference as to what this does, could someone point out what it is and what it does for me?
<FromGitter> <AZanellato> That is passing that variable to a block
<FromGitter> <AZanellato> if you have an array of numbers, for example, numbers = [1, 2, 3, 4, 5]
<FromGitter> <AZanellato> you can do numbers.each { |n| puts n}
<FromGitter> <CreationFox> Ok, so, if I'm understanding correctly, it's like in C++ when you load arguments into a function?
<FromGitter> <CreationFox> Let me be more specific.
<FromGitter> <AZanellato> Kindof, yeah.
duane has quit [Ping timeout: 248 seconds]
<FromGitter> <AZanellato> it is similar to the calling of a function in C++, except here the function before the block determines which arguments it will supply to it
<FromGitter> <AZanellato> it isn't you giving |x| to each
<FromGitter> <AZanellato> but `each` giving you a variable, that you name it `x `
<FromGitter> <AZanellato> does that make sense?
duane has joined #crystal-lang
<FromGitter> <CreationFox> Alright, I think I'll try it out to make sure I can understand.
pabs has quit [Ping timeout: 240 seconds]
pabs has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
pabs has quit [Ping timeout: 240 seconds]
pabs has joined #crystal-lang
pabs has quit [Ping timeout: 260 seconds]
pabs has joined #crystal-lang
_whitelogger has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
sz0 has joined #crystal-lang
<FromGitter> <S-YOU> Figured that h2o to run without libuv, and it is even faster (upto 150k/s on my machine, with libuv was 120k/s)
baweaver is now known as baweaver_away
<FromGitter> <codenoid> hi
<FromGitter> <codenoid> how to generate random word
<FromGitter> <codenoid> with crystal
<FromGitter> <codenoid> random
<FromGitter> <codenoid> string
<FromGitter> <codenoid> with ruby
<FromGitter> <codenoid> `(0...8).map { (65 + rand(26)).chr }.join`
<FromGitter> <S-YOU> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1b8bdcdd54362753faf918]
<FromGitter> <Grabli66> Hi. Is it possible to use crystal on bare metal devices?
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter> <fgimian> hey guys, is there an equivalent of Ruby's instance_variables in Crystal?
<FromGitter> <S-YOU> I never used myself, but there is seems to be one ⏎ https://crystal-lang.org/docs/syntax_and_semantics/macros/macro_methods.html
<FromGitter> <fgimian> ta
<FromGitter> <S-YOU> `{{ @type.instance_vars }}`
<FromGitter> <fgimian> just was checking that out now in fact, thank you
<FromGitter> <fgimian> πŸ˜„
<FromGitter> <S-YOU> πŸ‘
<FromGitter> <fgimian> what I'm attempting to do (perhaps you can give me a few tips) is the following
<FromGitter> <fgimian> I have created a macro for defining "arguments" for my class
<FromGitter> <fgimian> e.g.
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1ba41a9ca98417e2576676]
<FromGitter> <fgimian> this simply creates an instance variable for each, does some validation and sets the appropriate default value or nil if there isn't one
<FromGitter> <fgimian> what I'm attempting to do next (hence my question above), is generate a method which does something like this ⏎ ⏎ ``` def arguments ⏎ {name: @name, state: @state, options: @options} ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5b1ba4630b75bc7d5af6a171]
<FromGitter> <fgimian> which I will use when printing out to the user what they've passed in
<FromGitter> <fgimian> I realised that instance_vars is a bad idea, because I could potentially define my own additional instance_vars for internal processing
<FromGitter> <fgimian> so I just need to think of a nice way that I can use macros to build an array of argument names, and then return them using their `@bla` instance variable in a named tuple as shown above
* FromGitter * fgimian hopes that makes some sense ... :)
<FromGitter> <fgimian> was just re-reading the docs on macros to understand what they can do and how one could approach this problem with them
<FromGitter> <S-YOU> agree that instance_vars may be not for all use cases. ⏎ I am not sure, I understand what is result you are trying to achieve.
<FromGitter> <S-YOU> it is something equivalent from python or ruby?
<FromGitter> <fgimian> nah not quite, I'm just trying to design a DSL so that authors can write "actions" without having to do much work
<FromGitter> <fgimian> I just want them to be able to define their arguments, and then a run method that does tho work
<FromGitter> <fgimian> I'll try this a bit longer and I'll push up some code to GitHub soon, perhaps I'll share it here if I'm still stuck to get a second opinion
<FromGitter> <fgimian> thanks heaps @S-YOU πŸ˜„
<FromGitter> <S-YOU> ```macro something(*args) ⏎ {% for x in args %} ⏎ .... ``` ⏎ ⏎ will not work? [https://gitter.im/crystal-lang/crystal?at=5b1ba80de36e0e7d3f603156]
<FromGitter> <S-YOU> okay
<FromGitter> <fgimian> I could potentially do it like that actually, I was trying to make it one call per arg, similar to admiral.cr
<FromGitter> <fgimian> I'm using its code as a reference for some ideas πŸ˜„
<FromGitter> <fgimian> I'll get there, i'm really close
<FromGitter> <S-YOU> Interesting idea
<FromGitter> <fgimian> yeah, I'll share when I'm done for sure
<FromGitter> <fgimian> so I got it going, I had to store the names in a class constant and then, the trick was to use the `{% begin %}` block to build a valid named tuple
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1baf7bd7b4f6288cb9fa1f]
<FromGitter> <fgimian> like this πŸ˜„
<FromGitter> <S-YOU> I see. I don't know why it requires begin end though.
<FromGitter> <fgimian> me either but that seems to do the trick πŸ˜„
faustinoaq has joined #crystal-lang
<faustinoaq> Crystal is awesome! (testing IRC bridge, ignore me :-P)
<FromGitter> <fgimian> Crystal is awesome indeed πŸ˜„
<faustinoaq> Interesting, JVM and .NET Frameworks on TFB use an entire test only for plaintext and another just for json, like `aspnet-core-plaintext` and `aspnet-core-json`, `<@jvm-framework-here>-plaitext`, etc
<faustinoaq> Crystal on TFB is using just one app to accomplish all tests, maybe we can create `crystal-plaintext`, `crystal-json`, etc WDYT?
<faustinoaq> This can ensure the compiler is optimizing the app to be fast in just one test at time :)
<FromGitter> <mvlootman> @faustinoaq You use both Crystal (personal projects) and .Net/C# (work), right? What do you think are advantages of using Crystal over .Net? Is it just a language preference?
<faustinoaq> Yep, I use .NET at work and at uni, C# and VB (even F#) are very nice, they have a great toolbox, high demanded, cross-platform and fast, very fast :), although...
<faustinoaq> The .NET environment is a bit tricky in some ways (same as JVM)
<FromGitter> <j8r> @fgimian You need `{% begin %} and {% end %}` because inside `{ {% for ... end%} }` isn't valid Crystal code, but a macro that generate one.
<faustinoaq> Crystal feels more friendly and robust, so is easier to code my ideas with a bit of safety :)
<FromGitter> <mvlootman> I like the syntax of Crystal and start to dislike C# more with the addition of more and more features.
<FromGitter> <mvlootman> I hope Crystal gets mature enough v1.0 so it can handle compilation of big projects without memory/compilation time issues
<faustinoaq> Yeah, Writing an algorithm in Crystal is way easier (like Python, Ruby) than Java or C#/VB. Crystal has a dynamic feel with types and fast execution :)
<faustinoaq> @mvlootman I think we can achieve that by cleaning up the language and removing a lot of things that are making crystal slow at compile time.
<FromGitter> <mvlootman> Currently working with Go, but that is mainly because of Crystal not reaching 1.0. Also golang has a bigger reach, for instance support on AWS serverless. I think Crystal could be a good fit there too.
<faustinoaq> "...Remove inessential or redundant language features.."
<FromGitter> <mvlootman> yes I read that. But also read some Gitter messages from Ary, that worried me a little, like full type inference was perhaps a hinderance (compile time/memory)
<faustinoaq> Yeah, crystal is very young, we still need to enhance/fix/implement a lot of things to be stable enough ;-)
<FromGitter> <mvlootman> But I keep coming back to look at how Crystal is doing, because it still appeals to me very much. πŸ˜„
faustinoaq has quit [Ping timeout: 264 seconds]
faustinoaq has joined #crystal-lang
<faustinoaq> @mvlootman I also was worried about that. Don't pay attention to Ary :-P, He had some ups and downs with crystal ;-)
<FromGitter> <mvlootman> thanks for the link!
That_Guy_Anon has joined #crystal-lang
<FromGitter> <fgimian> @j8r thanks so much for the clarification mate πŸ˜„
Groogy has joined #crystal-lang
Groogy has quit [Client Quit]
<FromGitter> <faustinoaq> ^^ Vertx (top tier, fastest framework on TFB)
<FromGitter> <faustinoaq> ^^ Minimal memory usage 40MB
<FromGitter> <faustinoaq> vs
<FromGitter> <faustinoaq> ^^ Crystal (Modest-performance on TFB)
<FromGitter> <faustinoaq> ^^ Compiled and statically typed. Minimal resource usage is 5MB!!! 😎
<FromGitter> <faustinoaq> Also the crystal code for `server.cr` is way simpler that an entire Vertx project (https://github.com/Jotschi/vertx-graalvm-native-image-test) πŸ˜‰
<FromGitter> <S-YOU> I am curious of LOC of each sources on TFB, crystal might be be one of the cleanest implementation out there.
<FromGitter> <mvlootman> benchmark results should also show memory / cpu usage to do a fair comparison
Groogy has joined #crystal-lang
<FromGitter> <fgimian> Just another question from me, suppose we have a union type of `Array(String) | Nil` and I'm certain that the data in there is an `Array(String)`; how do I force it to be turned into that type so that all related methods work?
<FromGitter> <fgimian> actually never mind, I found my problem
<FromGitter> <fgimian> my value was actually nil, which was causing my problem
<FromGitter> <j8r> @faustinoaq I'm writing a text editor/IDE in Crystal :) https://imgur.com/a/Fk8rA6a
<FromGitter> <j8r> quite buggy for now though :(
<FromGitter> <j8r> The goal is to have a lightweight, modular CLI IDE
<FromGitter> <S-YOU> Nice
<FromGitter> <fgimian> awesome!!
<FromGitter> <fgimian> ok ... so I am actually still having drama on my end, and I now have some code that can repro my problem
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1bd89c6077c67d3ede3de2]
<FromGitter> <j8r> I'm near to an initial release, it will be close to nano/micro at first. I'm still to figure out how Termbox works under the ground, there are lines that disapear and redraw incorectly
<FromGitter> <fgimian> output ⏎ ⏎ ```Couldn't find overloads for these types: ⏎ - Array(String)#+(other : Nil)``` [https://gitter.im/crystal-lang/crystal?at=5b1bd8b39ca98417e257ef5d]
<FromGitter> <j8r> why `Nil`?
<FromGitter> <fgimian> I'm unfortunately not aware of any way to get around that, as I'm writing a DSL in Crystal
<FromGitter> <fgimian> which means that the member variable will be empty until the appropriate method is called to set it
<FromGitter> <fgimian> I'm using macros to generate this
<FromGitter> <fgimian> ```puts ["bleh"] + options``````
<FromGitter> <fgimian> this works though
<FromGitter> <fgimian> but when you do it in a class, there are issues
<FromGitter> <fgimian> I'll push up my latest code to show ya where I'm at, maybe then it will make a bit more sense
<FromGitter> <j8r> you can do a `if !@options.nil?`
<FromGitter> <j8r> and a `else; raise "error"`
<FromGitter> <j8r> but it should be a better way to do this
<FromGitter> <S-YOU> you cant join array with nil right?
<FromGitter> <S-YOU> what's wrong with `@options : Array(String) = ["abc", "def"]`?
<FromGitter> <fgimian> the problem is mostly to do with the fact I'm trying to make it a DSL
<FromGitter> <fgimian> I just pushed the latest code on GitHub
<FromGitter> <fgimian> let me show ya where I'm at
<FromGitter> <S-YOU> or may be you can add `def +(other : Nil)` to array
<FromGitter> <fgimian> example usage would be
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1bda41ffd8896fe916b01a]
<FromGitter> <fgimian> perhaps I've tried to abstract too much away with macros or DSLs
<FromGitter> <fgimian> I should say in advance, *please forgive me* if I've done some terrible things ... I'm still trying to get to grips with Crystal and expect that I would have done some things badly which I'll laugh about in a few months πŸ˜„
<FromGitter> <S-YOU> May be I would patch array for that case. ⏎ ⏎ ```class Array(T) ⏎ def +(other : Nil) ⏎ self ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5b1bdaab4b2d9417e1d75086]
<FromGitter> <j8r> That's not the best way to solve this :-/
<FromGitter> <fgimian> hehehe
<FromGitter> <fgimian> the guts of the code is in `action.cr` and `actions/brew.cr`
<FromGitter> <j8r> in general try to avoid nils as possible, and doing not_nil! also
<FromGitter> <fgimian> yeah, that's really what I want to do
<FromGitter> <S-YOU> At the and, crystal still compiling the whole standard library with your program, does not matter much.
<FromGitter> <fgimian> I just can't see any way at all to do this with a DSL type of approach
<FromGitter> <j8r> Try to make conditions like `if !myvar.nil?` and it will solve your problem
<FromGitter> <j8r> and raise an error
<FromGitter> <fgimian> I honestly thought I tried that, and it didn't help in this case
<FromGitter> <fgimian> when I actually do `@options.class`, it IS an `Array(String)`
<FromGitter> <fgimian> as you can see, I've set the default to `[] of String` and I don't override it
<FromGitter> <fgimian> I event did a `puts @options` and it shows `[]`
<FromGitter> <fgimian> hehehe
<FromGitter> <j8r> what the error when removing `| Nil`?
<FromGitter> <fgimian> gimme 2 secs, i'll grab it
<FromGitter> <fgimian> it would generate code like this
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1bdb9a106f3c24bde9676a]
<FromGitter> <fgimian> the error is
<FromGitter> <fgimian> ``` ⏎ @options : Array(String) ⏎ ^~~~~~~~``` [https://gitter.im/crystal-lang/crystal?at=5b1bdba2106f3c24bde9677d]
<FromGitter> <fgimian> which of course makes sense
<FromGitter> <fgimian> but I'm trying to write a DSL similar to Ruby-land
<FromGitter> <j8r> can you `@options : Array(String) = Array(String).new`?
<FromGitter> <fgimian> let me try
That_Guy_Anon has quit [Ping timeout: 265 seconds]
<FromGitter> <fgimian> hmm that does actually work
<FromGitter> <fgimian> not a bad idea really
<FromGitter> <j8r> To explain, you have to specify a default value
<FromGitter> <j8r> Because it may not be initialized, like the error told, therefore rendering it nil
<FromGitter> <fgimian> yeah
<FromGitter> <fgimian> I like your idea because it makes it easy to incorporate into my macro
<FromGitter> <fgimian> of course, the only tricky thing will be stuff like an Int which will default to 0 I assume
<FromGitter> <j8r> you can also do this inside a `def initialize(@options = Array(String).new); end`
<FromGitter> <fgimian> yeah, sadly that's a lot harder to generate with the macro
<FromGitter> <fgimian> because I run the macro for each "argument"
* FromGitter * fgimian hopes that makes sense
<FromGitter> <fgimian> let me try your approach though, perhaps it'll get me through
<FromGitter> <fgimian> it may not work for certain types it seems, like Ints .etc, I'll need to deal with those differently
<FromGitter> <j8r> You need Ints?
<FromGitter> <fgimian> well, ultimately each action can do anything, e.g. installing a Homebrew package, creating a file, updating a plist file .etc .etc, so in theory, yeah, the parameters can be of any type
<FromGitter> <fgimian> depending on the action
<FromGitter> <fgimian> maybe I need to go back to the drawing board on this πŸ˜„
<FromGitter> <fgimian> I have done it successfully with Python, but of course, that doesn't care about types much πŸ˜†
<FromGitter> <fgimian> in Python I simply set all unset values to `None` (same as `nil`) and then check if the argument had any data with a conditional
<FromGitter> <fgimian> ultimately I would face a similar challenge in any typed language, so just need to maybe rethink my approach
<FromGitter> <j8r> `crystal tool format` may fix this... I guess
<FromGitter> <fgimian> haha yep, that's a direct port of my original code
<FromGitter> <fgimian> will do that now, sorry, I'm still getting to grips with it
<FromGitter> <j8r> no worry, that's fine :-)
<FromGitter> <fgimian> πŸ˜„
<FromGitter> <fgimian> oh haha, the format tool didn't change anything
<FromGitter> <fgimian> except aligning one comment
<FromGitter> <j8r> If you do system things, when you will need Ints? All is string?
<FromGitter> <fgimian> but I'll switch to a case statement for sure
<FromGitter> <fgimian> I'll need to double check my original implemented actions to see if I used ints to be honest
<FromGitter> <fgimian> I definitely use booleans, strings and arrays of strings
<FromGitter> <j8r> you can also use Strings everywhere and cast when needed
<FromGitter> <fgimian> My original implementation has 29 actions for many things, npm, pip, brew, brew cask, brew tap, files, archives .etc .etc
<FromGitter> <fgimian> true
<FromGitter> <fgimian> I'm essentially developing something like Chef ... but specifically for configuring Macs
<FromGitter> <fgimian> hehehe
Raimondii has joined #crystal-lang
<FromGitter> <fgimian> most params are strings, that's true though
<FromGitter> <fgimian> just checking my original code now
<FromGitter> <fgimian> yeah, looks like only 1 - 2 parameters were ever ints, the main one was I have an action for manipulating JSON files and I pass the indent level in as a int
<FromGitter> <j8r> That's interesting πŸ˜„ How is the configuration?
<FromGitter> <fgimian> well, in my original implementation, the config was mostly YAML
<FromGitter> <fgimian> however, my idea in Crystal is to do it ... IN Crystal
<FromGitter> <fgimian> πŸ˜„
Raimondi has quit [Ping timeout: 264 seconds]
<FromGitter> <j8r> Like a NamedTuple?
Raimondii is now known as Raimondi
<FromGitter> <fgimian> actually more like a DSL
<FromGitter> <fgimian> here is part of my concept
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1bdf08dd54362753fbda1f]
<FromGitter> <fgimian> actually very similar to Chef
<FromGitter> <fgimian> πŸ˜„
<FromGitter> <fgimian> but sadly this means I must use class methods to set each parameter
<FromGitter> <fgimian> alternatively, I can just make these all regular methods and avoid blocks
<FromGitter> <fgimian> e.g.
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1bdf53106f3c24bde970fb]
<FromGitter> <fgimian> this may be easier and allow more flexibility with types as I don't have to do all the fancy tricks
<FromGitter> <j8r> note that's better to use `"latest"` instead `:latest` (Symbol has special use cases)
<FromGitter> <fgimian> oh ok, thanks for noting that
<FromGitter> <fgimian> in Ruby they mainly use symbols so I copied that behaviour
<FromGitter> <fgimian> i was using strings in Python so happy to switch back
<FromGitter> <j8r> some are even talking about removing it, but it's useful for namedtuple and arguments so it's staying
<FromGitter> <fgimian> ah gotcha
<FromGitter> <fgimian> thanks for the tip
<FromGitter> <fgimian> so I hope you can see what I'm trying to do, have you ever implemented a DSL of this style with Ruby or Crystal?
<FromGitter> <fgimian> you basically have to implement methods to set each instance variable
<FromGitter> <j8r> note also you can use tuples instead of arrays if they are static ;-)
<FromGitter> <j8r> Nope
<FromGitter> <fgimian> true yeah
<FromGitter> <fgimian> yeah, this is my first time
<FromGitter> <j8r> I've looked at doing this for a CLI interface
<FromGitter> <fgimian> aah cool
<FromGitter> <fgimian> the main thing you need is
<FromGitter> <fgimian> ```with <bla> yield```
<FromGitter> <fgimian> and then what essentially happens is, each function call inside the block becomes a method call
<FromGitter> <fgimian> I have a little demo example handy if you are interested in seeing a small working example
<FromGitter> <j8r> yes of course, thanks
<FromGitter> <fgimian> np, i'll grab it
pabs has quit [Ping timeout: 265 seconds]
<FromGitter> <j8r> you can post it in carc.in or gist πŸ˜‰
<FromGitter> <j8r> For CLI I've decided to go to the macro way (https://github.com/j8r/clicr) instead of the DSL one (https://github.com/jwaldrip/admiral.cr)
<FromGitter> <fgimian> sure
<FromGitter> <fgimian> yeah, I think that may be better
<FromGitter> <j8r> yes that depends. With macro you have compile time check
<FromGitter> <fgimian> As you can see above, I have explicitly initialized those instance variables
<FromGitter> <fgimian> but I'm trying to make the interface when developing actions very easy
<FromGitter> <j8r> But If you go with this, everyone that use your program has to install crystal :-/
<FromGitter> <fgimian> that is very true
<FromGitter> <fgimian> this is why I considered using YAML for config
<FromGitter> <fgimian> the thing is that ... I want it to be powerful
<FromGitter> <fgimian> but yes, I did almost everything with YAML in my original implementation
<FromGitter> <fgimian> perhaps that's the way I will need to go here too
<FromGitter> <fgimian> I'll definitely need to rethink my approach and possibly start over in many places
<FromGitter> <fgimian> as you can see, I was clearly inspired by Chef
<FromGitter> <fgimian> here's an example of Chef
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1be2e5ddd61d08e541726a]
<FromGitter> <fgimian> πŸ˜„
<FromGitter> <fgimian> anyways, I better get to bed, it's really late
<FromGitter> <fgimian> thanks for your help and the chat
<FromGitter> <fgimian> hope you have an awesome day πŸ˜„
<FromGitter> <fgimian> interesting approach
<FromGitter> <fgimian> if I did it in YAML, I would probably be more similar to Ansible tbh
<FromGitter> <fgimian> or my original implementation
pabs has joined #crystal-lang
<FromGitter> <j8r> This will be more expressive but more verbose
<FromGitter> <fgimian> yeah
<FromGitter> <fgimian> well matey, I'm gonna get to bed
<FromGitter> <fgimian> thanks again for your help and the chat
<FromGitter> <fgimian> πŸ˜„
<FromGitter> <j8r> thank you for the gist, see you!
<FromGitter> <fgimian> my pleasure, seeya
That_Guy_Anon has joined #crystal-lang
pabs has quit [Ping timeout: 240 seconds]
pabs has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 255 seconds]
pabs has quit [Ping timeout: 264 seconds]
pabs has joined #crystal-lang
pabs has quit [Ping timeout: 260 seconds]
pabs has joined #crystal-lang
duane has joined #crystal-lang
akaiiro has joined #crystal-lang
faustinoaq has quit [Remote host closed the connection]
faustinoaq has joined #crystal-lang
pabs has quit [Ping timeout: 248 seconds]
pabs has joined #crystal-lang
<FromGitter> <j8r> Yes I've a working text editor, i release it to https://github.com/j8r/cride today or tomorrow :D
<FromGitter> <j8r> https://imgur.com/a/q1K4Ows
<faustinoaq> Hey @/all I just created [Amber Users](https://amberframework.gitbook.io/amber/amber-users), using Amber? Please add yourself to the list :-)
akaiiro has quit [Ping timeout: 265 seconds]
<FromGitter> <S-YOU> The link redirects to /amber/, is it normal?
DTZUZO has quit [Quit: WeeChat 2.0]
DTZUZO has joined #crystal-lang
faustinoaq has quit [Ping timeout: 260 seconds]
faustinoaq has joined #crystal-lang
<faustinoaq> @S-YOU Oh, that's wrong, amber-user should work fine, I think is a gitbook bug or something similar ;-)
<faustinoaq> I guess something is wrong with this revision: https://amberframework.gitbook.io/amber/~/revisions/-LE_caHg0fVGgM45wD74/amber-users
jokke2 has joined #crystal-lang
oprypin has quit [Ping timeout: 245 seconds]
fifr[m] has quit [Ping timeout: 245 seconds]
jokke has quit [Ping timeout: 245 seconds]
oprypin has joined #crystal-lang
braidn[m] has quit [Ping timeout: 240 seconds]
byteflame has quit [Ping timeout: 240 seconds]
Renich has quit [Ping timeout: 255 seconds]
olbat[m] has quit [Ping timeout: 256 seconds]
DSNTravellerbot[ has quit [Ping timeout: 256 seconds]
kp666[m] has quit [Ping timeout: 256 seconds]
kixune[m] has quit [Ping timeout: 256 seconds]
cptaffe has quit [Ping timeout: 276 seconds]
jokke2 has quit [Ping timeout: 240 seconds]
jokke2 has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
pabs has quit [Ping timeout: 265 seconds]
pabs has joined #crystal-lang
pabs has quit [Ping timeout: 255 seconds]
pabs has joined #crystal-lang
GoldenBear has quit [Ping timeout: 245 seconds]
olbat[m] has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #6160: Allow redefining None to 0 for @[Flags] enum (master...allow-redefine-None-to-0-in-enum-flags) https://git.io/vhly9
akaiiro has joined #crystal-lang
pabs has quit [Ping timeout: 240 seconds]
mech422 has joined #crystal-lang
<mech422> Hi All - stupid question, but I can't find it in the 'syntax and semantics' doc - what do '|' symbols do? as in: thrice do |i|...
<mech422> seems to be some sort of variable declaration ? (you can refer to it in the do block..) or is it just the receiver for the yield statement ?
pabs has joined #crystal-lang
<FromGitter> <paulcsmith> Is there a built-in way to detect what OS Crystal is being run on? I'm trying to load a binary depending on whether the user is on Linux or Mac and hoping something is built-in but I don't see anything in the docs
akaiiro has quit [Ping timeout: 260 seconds]
<travis-ci> crystal-lang/crystal#44ff90e (master - Allow redefining None to 0 for @[Flags] enum (#6160)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/390219091
<DeBot> https://github.com/crystal-lang/crystal/pull/6160 (Allow redefining None to 0 for @[Flags] enum)
braidn[m] has joined #crystal-lang
fifr[m] has joined #crystal-lang
byteflame has joined #crystal-lang
Renich has joined #crystal-lang
kp666[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
kixune[m] has joined #crystal-lang
<RX14> lol it looks like bcardiff is peaking out from behind straight-shoota's avatar http://owo.sh/3714fd.png
<Yxhuvud> paulcsmith: see usages of flag? in the compiler
<FromGitter> <paulcsmith> Thanks @yxhuvud! I'll check it out
<FromGitter> <paulcsmith> That did it! `flag?(:darwin)` and `flag?(:linux)`
akaiiro has joined #crystal-lang
<faustinoaq> Maybe we can run crystal here ^^ XD
<faustinoaq> BTW, Have someone tried to create a crystal snap package? https://docs.snapcraft.io/build-snaps/languages
pabs has quit [Ping timeout: 245 seconds]
pabs has joined #crystal-lang
<RX14> hopefully not
<RX14> well, people are free to do whatever they want but snaps are terrible
snsei has joined #crystal-lang
<akaiiro> faustinoaq snaps and flatpacks are awful. appimages seem nice
<RX14> they're all bad tbh
<RX14> just make distro packages
<RX14> its not that hard
pabs has quit [Ping timeout: 240 seconds]
pabs has joined #crystal-lang
<faustinoaq> RX14 Oh ok :)
<FromGitter> <j8r> Hum ok @RX14 you have to use fpm or package it to deb, rpm, apk, and pkgbuild - and deal with the dependency hell. If you have lots of dependencies, good luck 😐
<RX14> nope
<RX14> you make your software packageable
<RX14> and wait for the distro maintainers to do the work
<RX14> I wish :)
<FromGitter> <j8r> If you have e.g. Centos 6 and wants new libs?
<RX14> but really fpm isn't so hard to use
<RX14> and if you make one self-contained tarball it's super easy to unpack it into /usr
<RX14> and make sure you comply with FHS
<RX14> then a few tweaks to man and licence files per distro, maybe docs and you're all set
<FromGitter> <j8r> That's a bit like an appimage a self-contained tar.gz. Please do not untar it to /usr, you may mess up your system OMG β­•
<FromGitter> <j8r> `/usr/local` at least
<FromGitter> <j8r> but anyway, appimages have their uses for desktop apps. But on the server side, this is another story
<RX14> no
<RX14> you untar to /usr in the package build directory
<RX14> then the package contains the tar contents at /usr
<RX14> and thats fine
<RX14> thats exactly how I built the new crystal packages:
<RX14> i built a tar.gz with a statically-linked compiler that conformed to the FHS, then untarred the tar.gz into /usr, fiddled around with the files a bit to conform to the letter of the per-distro packaging guidelines
<RX14> and then packed it up
<RX14> untarring into /usr is only bad if it's actually /usr not $PKGROOT/usr :)
<FromGitter> <j8r> But the `/usr` may be modified by system packages. And you tar.gz isn't a dist package, you can have problems
<FromGitter> <j8r> nothing tells the system you have actually untarred :-/
<FromGitter> <j8r> haa ok `$PKGROOT/usr :`
<FromGitter> <j8r> got itΓΉ
<FromGitter> <j8r> Too bad we aren't on BSD
<FromGitter> <j8r> You can install packages as user - and eventually do messy things without impacting the OS. Why the hell we need to be root on linux :3
akaiiro has quit [Ping timeout: 265 seconds]
<RX14> no
<RX14> you didnt listen#
<RX14> oh
<RX14> yes you did
<RX14> i should read fully before I reply lol
<FromGitter> <fgimian> hey guys, is there a way to catch multiple exceptions? ⏎ ⏎ e.g. ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5b1c65e66077c67d3edfbcba]
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b1c65f2ffd8896fe9182b43]
<FromGitter> <fgimian> this is a syntax error presently `expecting any of these tokens: ;, NEWLINE (not ',')`
<FromGitter> <fgimian> oh found it
<FromGitter> <fgimian> I must use `|`
<FromGitter> <fgimian> never mind me πŸ˜„
<FromGitter> <fgimian> yay that worked