ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.21.1 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
<FromGitter> <mhsjlw> Hey, is there a `String.pad` or any sort of equivalent?
<FromGitter> <mhsjlw> If not, I think it might be useful. I'd be willing to contribute one
<FromGitter> <mhsjlw> There is lots of functions for removing whitespace
<FromGitter> <mhsjlw> Elixir does a good job (I feel) with `pad_leading` and `pad_trailing` https://hexdocs.pm/elixir/String.html#pad_leading/3, something similar might be nice
<FromGitter> <mhsjlw> I'm also curious if it is possible to extend `String` from a project to add things just project-wide
<FromGitter> <phoffer> You’re looking for `String#rjust` and `String#ljust`
<FromGitter> <mhsjlw> Awesome, thanks.
DTZUZU has quit [Quit: WeeChat 1.5]
snsei has joined #crystal-lang
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vSEpi
<crystal-gh> crystal/master eae4193 Ary Borenszweig: IO#peek now returns an empty slice on EOF. Fixes #4240
<FromGitter> <jwaldrip> So exicited! Just booked my tickets and hotel for the SF conference in may!
<FromGitter> <jwaldrip> I would love to see who else is going. Anyway to show that on the eventbrite site?
<adam12> @jwaldrip what do you think the trip will cost you in total?
<FromGitter> <jwaldrip> 350 for ticket + 400 for hotel + 166 Airfare + 150 for meals and entertainment
<adam12> @jwaldrip That doesn't seem too pad. Where you flying from?
<FromGitter> <jwaldrip> Denver, Co
<adam12> s/pad/bad.
<adam12> Oh - jeez. A skip and a jump for you. LOL.
<FromGitter> <jwaldrip> Correct, what about you/
<adam12> I'm not going - but if I was, it would be from Niagara Falls, Canada.
<adam12> Which means a 30% premium to buy USD, crossing the border, and some other less than stellar things.
<FromGitter> <jwaldrip> Not too bad. My wife used to live in Syracuse.
<adam12> Nice.
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
danielpclark has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
olek_poz has joined #crystal-lang
olek_poz has quit [Ping timeout: 260 seconds]
snsei has quit [Remote host closed the connection]
olek_poz has joined #crystal-lang
mark_66 has joined #crystal-lang
Qchmqs has joined #crystal-lang
gewo has joined #crystal-lang
Raimondii has joined #crystal-lang
Qchmqs has quit [Quit: Konversation terminated!]
Qchmqs has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
gloscombe has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <KCreate> Hey, is `type` a keyword in crystal? Or does it have any special role in the syntax?
<FromGitter> <KCreate> Because github and most syntax highlighters highlight it as a keyword
McSoFake has joined #crystal-lang
<FromGitter> <bew> I'm trying to run crystal play in an AWS EC2 instance to test things (I'm new to aws), but I always get connection refused.. I checked with a simple python server that it's not the port that is blocked, so I don't know what to do..
<FromGitter> <bew> it does not look like it's a crystal issue, because I can get the page from the instance itself, but not outside it
<FromGitter> <bew> nvm I needed to bind to 0.0.0.0
<FromGitter> <bew> now I get ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e4b1c40e4137042ae59e74]
<FromGitter> <bew> but I don't need thoses libraries for the little tests I want to do
<FromGitter> <bew> why do I still need them (libz, libssl, libcryptyo) to compile simple program ?
<FromGitter> <bew> libcrypto*
A124 has quit [Quit: '']
A124 has joined #crystal-lang
<FromGitter> <sdogruyol> @jwaldrip i'll be at CodeCamp too :)
<FromGitter> <sdogruyol> @bew they're required for std
<FromGitter> <sdogruyol> it's not that you have all that dependencies in the binary
<FromGitter> <bew> so why do I need them if it'll not be linked in my binary ?
<FromGitter> <sdogruyol> because crystal std needs them?
<FromGitter> <bew> hum..
<FromGitter> <sdogruyol> currently we dont have statically compiled binaries (like go) by default
<FromGitter> <bew> the stdlib needed for the program I try to compile is everything in prelude + every std requires I have in the program right ?
<FromGitter> <sdogruyol> yeah
<FromGitter> <bew> the program I try to compile has no require (it's the default crystal play example), and I don't think libssl, libcrypto & libz are needed in prelude stdlib..
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> for example, the only way to have libssl to be needed is by requiring `openssl` and this is not required in prelude , so why do I need that ? what is the require graph that require openssl somewhere?..
olek_poz has quit [Ping timeout: 260 seconds]
olek_poz has joined #crystal-lang
<FromGitter> <crisward> Anyone done any stubbing in crystal ? ie, replacing a real module with a mocked one to see what methods are called with what values, then returning dummy data.
blufor has quit [Read error: Connection reset by peer]
<FromGitter> <0800nacho_twitter> Good morning. New to Crystal here. Having so much fun. One quick question: I’m trying to get a .md file loaded in the playground. But I cannot find the correct location to place this file. I’m on macOS. I’ve tried ~/playground ~/.playground but no success so far...
<FromGitter> <mjago> @0800nacho_twitter welcome!
<FromGitter> <mjago> you can do ``` ⏎ puts Dir.current ⏎ ⏎ ```File.open(“file.md”, “r”) do |f| ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=58e4da48408f90be668e5fea]
bjz has joined #crystal-lang
<FromGitter> <0800nacho_twitter> @mjago thanks! Will try that.
<RX14> I seem to have inspired the ruby ROM dev to try out crystal haha
<FromGitter> <mjago> Read Only Memory?
<FromGitter> <mjago> oh cool!
<FromGitter> <sdogruyol> yeah solnic doing a good job with rom
<FromGitter> <0800nacho_twitter> @mjago That worked. Thanks again.
blufor has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pduncan has joined #crystal-lang
McSoFake has quit [Ping timeout: 256 seconds]
<FromGitter> <asterite> @bew crystal play compiles a program that sends the results via websockets, so a lot of libraries are needed besides those that you just use in the playground
<FromGitter> <asterite> Basically the program you write in the playground gets transformed to a bigger one
<FromGitter> <bew> oh I see, makes sense like this, but why the results are not simply gathered in the server, and when finished, sent to the playground ?
olek_poz has quit [Read error: Connection reset by peer]
gloscombe has quit [Ping timeout: 268 seconds]
gloscombe has joined #crystal-lang
<FromGitter> <willricketts> hola
<RX14> hi
<FromGitter> <fridgerator> hi
<FromGitter> <crisward> Anyone know why this isn't working. Expecting it to return hello world. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58e4f71c68bee3091f11c9e9]
<FromGitter> <crisward> Ahh, does extend only work with class methods?
<FromGitter> <chuckremes> @crisward `extend` makes class methods
<FromGitter> <chuckremes> You want `include` to get the instance behavior you seek.
<FromGitter> <crisward> tried include.
<FromGitter> <crisward> Doesn't override an already created method is would seem.
<FromGitter> <crisward> Is there something like prepend?
InternetFriend has joined #crystal-lang
<InternetFriend> yes
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 268 seconds]
<crystal-gh> [crystal] splattael closed pull request #3705: [WIP] Allow testing on GitLab CI (master...gitlab) https://git.io/v1SF8
olek_poz has joined #crystal-lang
Qchmqs has quit [Read error: Connection reset by peer]
Qchmqs has joined #crystal-lang
bjz has joined #crystal-lang
NIk-- has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
bjz has joined #crystal-lang
<FromGitter> <bararchy> @sdogruyol Did you manage to compile the multi-thread Crystal ? ⏎ If so , any performance boost you can share ?
mark_66 has quit [Remote host closed the connection]
Qchmqs has quit [Ping timeout: 246 seconds]
<FromGitter> <luislavena> @crisward I will say that reopening a class and include a module should redefine the method, so seems to be a bug (at least undefined behavior)
<FromGitter> <luislavena> But the same thing happens on Ruby, so perhaps is by design?
<FromGitter> <schoening> Are resizable arrays slower than static one's? Just curios. I got no usecase :p
snsei has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bmcginty has quit [Ping timeout: 260 seconds]
<FromGitter> <luislavena> @schoening recommend read the internals of Array: https://github.com/crystal-lang/crystal/blob/master/src/array.cr#L1318-L1337 see `check_needs_resize` and `resize_to_capacity`
snsei has joined #crystal-lang
bmcginty has joined #crystal-lang
<FromGitter> <luislavena> if you're adding a lot of elements, it might be better define an initial size to avoid all the `realloc` calls
<FromGitter> <luislavena> accessing the array in both cases will be the same (using `Indexable`)
snsei has quit [Ping timeout: 260 seconds]
<FromGitter> <schoening> Thx :)
Raimondi has quit [Quit: WeeChat 1.6-dev]
A124 has quit [Ping timeout: 240 seconds]
Raimondi has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 268 seconds]
A124 has joined #crystal-lang
McSoFake has joined #crystal-lang
_whitelogger has quit [K-Lined]
_whitelogger has joined #crystal-lang
<FromGitter> <elorest> So I know what *FILE* or *DIR* mean or at least how to use them. But sometimes I see other’s in macro’s for instance in the Slang templating engine a macro has *slang* in it. What does that mean and how is it defined?
olek_poz has quit [Ping timeout: 256 seconds]
McSoFake has quit [Quit: No reason]
gloscombe has quit [Remote host closed the connection]
<BlaXpirit> elorest, i dont get it
<FromGitter> <elorest> I guess it’s just a weird variable name.
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <luislavena> @elorest `__slang__` is actually the name of the IO reference, ECR names it `__io__` (guess makes more sense) https://github.com/crystal-lang/crystal/blob/master/src/ecr/macros.cr#L35-L39
<FromGitter> <elorest> @luislavena Thanks.
<FromGitter> <elorest> The crystal code campe was listed as $650 for the first few days at least but now it’s $315 for early bird. Was the first price a mistake or what happened there?
<FromGitter> <mverzilli> it wasn't a mistake, we got a lot of a feedback that it was too high for the current stage of the project so we decided to cut it down
<FromGitter> <elorest> Ok cool. That makes sense being it was $50 more than railsconf.
<FromGitter> <mrkaspa> Hi, I was trying to make a macro for creating a struct
<FromGitter> <mrkaspa> macro defstruct(name, *fields) ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ end [https://gitter.im/crystal-lang/crystal?at=58e544ee4cb8d0917360ef8c]
<FromGitter> <mrkaspa> it'll be called like this defstruct User, name : String, age : Int32
<FromGitter> <mrkaspa> but I don't know how to put the @ at the beginning of each variable in the initialize
<FromGitter> <asterite> @mrkaspa such macro already exists, it's called "record". You can see how it's implemented
<FromGitter> <mrkaspa> @asterite awesome I'll take a look
<FromGitter> <mrkaspa> @asterite what is the .id for?
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
<FromGitter> <asterite> @mrkaspa https://crystal-lang.org/api/0.21.1/Crystal/Macros/ASTNode.html#id%3AMacroId-instance-method
<FromGitter> <mrkaspa> cool thanks
olek_poz has joined #crystal-lang
InternetFriend has quit [Ping timeout: 258 seconds]
bjz has joined #crystal-lang
NIk-- has quit [Quit: Textual IRC Client: www.textualapp.com]
olek_poz has quit [Ping timeout: 260 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <cavariux> Hi, just wondering. I'm seriously thinking of using crystal as a language for a big project but I wanted to ask first, is Crystal stable? And what can I spec from it in the future?
InternetFriend has joined #crystal-lang
InternetFriend has quit [Ping timeout: 240 seconds]
<Papierkorb> cavariux, Crystal is in alpha/beta state, and is not stable. I want to encourage you to try it, maybe even build some small service with it, but as of now, nothing mission critical. The stdlib API isn't stable either, there can and will be breakage. On top of that, there are still a list of open syntax change requests, some of which will be accepted.
<Papierkorb> cavariux, Crystal is in alpha/beta state, and is not stable. I want to encourage you to try it, maybe even build some small service with it, but as of now, nothing mission critical. The stdlib API isn't stable either, there can and will be breakage. On top of that, there are still a list of open syntax change requests, some of which will be accepted.
<FromGitter> <cavariux> @Papierkorb well thanks, I hope in the future crystal becomes a great language
<Papierkorb> It is a great language already, it's just not stable enough yet. If you know Ruby you'll feel at home
<FromGitter> <cavariux> So, do you know any other languages with functionalities like crystal? (Be able to link c, statically typed, natural syntax and compiled?)
<FromGitter> <jwoertink> @cavariux You could try Elixir. Not really static typed, but it does compile, and you can link C libs. Plus it has a pretty nice syntax
gewo has quit [Ping timeout: 258 seconds]
gewo has joined #crystal-lang
<FromGitter> <cavariux> Or what do you think guys? Should I stick to crystal (Cause I really love it) or should I go knock other doors?
<FromGitter> <jwoertink> The more the merrier
<FromGitter> <jwoertink> Plus, crystal will never become a solid language if no one is using it. So the more people using it for their needs, the more we can flesh out the kinks
<FromGitter> <cavariux> Thanks I really think I will stick to crystal cause I'm really liking it
<FromGitter> <jwoertink> :thumbsup:
<FromGitter> <phoffer> @cavariux another vote for sticking to Crystal
<FromGitter> <picatz> @cavariux In many ways, I would suggest looking elsewhere for the learning aspect of it. Looking elsewhere probably won't "taint" the way your feel about crystal. Maybe, in some ways, it will strengthen your love for crystal.
<FromGitter> <picatz> As I started working with Go, I quickly found myself remembering why I really love crystal. Granted, I still pressed on and looked to learn more about another language: I just find myself really appreciating my "main" languages the more I explore out into other languages. ( Just'ma opinion of course. )
<FromGitter> <picatz> And, Crystal was really easy to pickup and felt right at home as a "main" language. Probably something to do with my Ruby background.
<FromGitter> <jwoertink> Anyone know of a way to do something like `%w(x y) + {1, 2}` => `{"x" => 1, "y" => 2}` ?
<FromGitter> <jwoertink> aside from doing a few iterations to create the hash manually...
<FromGitter> <jwoertink> or how about turning a Tuple of types in to a union?
<FromGitter> <jwoertink> `{Int32, String}` => `Int32 | String`
<FromGitter> <picatz> @jwoertink Is that supposed to be two arrays zipping together into a hash?
<FromGitter> <picatz> if so: `Hash.zip(["x", "y"], [1, 2])`
<FromGitter> <jwoertink> It's an array and a tuple zipping together in to a hash
<FromGitter> <picatz> Ahh
<FromGitter> <jwoertink> darn, that would have been sweet if that worked
<FromGitter> <picatz> I sort'of wish it would just work that way :P
<FromGitter> <jwoertink> I'm not sure how difficult that would be, but that would be a nice PR
<FromGitter> <picatz> Indeedily'doo it would. Something def not to think about, bring up, and then forget about in the next 1/2 hour or so.
<FromGitter> <picatz> ( I would never do something like this. Never. )
<FromGitter> <jwoertink> or having a Union convert to a Tuple. `Union(Int32 | String).to_tuple` => `{Int32, String}`
gewo has quit [Ping timeout: 240 seconds]