ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | 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
<oprypin> yeah it's called `ln`
<oprypin> shards has an ability to copy files from a local folder not GitHub. but easier just to symlink
<watzon> Ok cool, thanks oprypin
<watzon> Follow up question, I can't remember the magic syntax for getting the current directory
<watzon> Something like `__DIR__`
<watzon> Or the directory of the file I should say
<watzon> Never mind lol, DIR seems to work
<crystal-gh> [crystal] coderhs opened pull request #5163: Time#days_in_year returns the no of days in a given year (master...feat/days_in_year) https://git.io/vdNzZ
snsei has joined #crystal-lang
<FromGitter> <faustinoaq> Interesting, Nametuples are very similar to JSON http://json.org/example.html ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ https://carc.in/#/r/2xs1 [https://gitter.im/crystal-lang/crystal?at=59ec05ad8808bed73d118041]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
gcds has quit [Ping timeout: 240 seconds]
<FromGitter> <coderhs> I think JSON needs to be explicitly defined as JSON. If we write like above it's a Named Tuple, immutable.
alex`` has joined #crystal-lang
RickHull has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <faustinoaq> Yeah, I know NameTuples are inmutable, I just wanted to compare to JSON 😉
<FromGitter> <faustinoaq> If I want mutable structure I would use a Hash
<FromGitter> <twharmon> I am trying to learn Crystal. I just noticed that when requiring files (require “json”), everything from that file is exposed to the entire app. If I require `json` in one file, I can use it in any file. Is this how it is supposed to behave? This is strange for me.
<FromGitter> <maiha_twitter> @twharmon `require` inserts code into there. So, it roughly looks like `cat *.cr > app.cr`. And then, Crystal run one file `app.cr`. So once you required some file, you can use it everywhere *after* the position.
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <pnloyd> In practice is all the requiring done in the entry point file?
<FromGitter> <pnloyd> As in.. does any kind of strange behavior or redundant work occur if a file is required multiple times.
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
alex`` has quit [Read error: Connection reset by peer]
rohitpaulk has quit [Ping timeout: 258 seconds]
rohitpaulk has joined #crystal-lang
alex`` has joined #crystal-lang
DTZUZU has quit [Ping timeout: 246 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
DTZUZU has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
DTZUZU has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
RickHull has quit [Ping timeout: 260 seconds]
andersh has quit [Ping timeout: 240 seconds]
DTZUZU has joined #crystal-lang
andersh has joined #crystal-lang
<FromGitter> <sdogruyol> morning everyone
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <monouser7dig> I don't get what asterite means with algebraic data types ⏎ `data List a = Nil | Cons a (List a)` ⏎ ⏎ that is just what he wants to remove ⏎ `alias Type = Nil | Bool | Int64 | Float64 | String | Array(Type) | Hash(String, Type)` [https://gitter.im/crystal-lang/crystal?at=59ec4b60b20c64242931d071]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <krypton97> Morning, morning
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<Yxhuvud> monouser7dig: You are not alone in not understanding what the difference would be. Perhaps we are reading the sentence wrong compared to what was intended.
<FromGitter> <monouser7dig> allright, is there any other (formal) manas person around here apart form asterite like at all in the past months?
<FromGitter> <monouser7dig> former*
<FromGitter> <iambudi> Is there any method like date time string to Time ?
<Papierkorb> iambudi, `Time.parse`
snsei has joined #crystal-lang
<FromGitter> <iambudi> @Papierkorb thanks, works perfectly.
<FromGitter> <sdogruyol> now I'll check #5155 again..
<DeBot_> https://github.com/crystal-lang/crystal/issues/5155 ([RFC] Remove recursive aliases)
rohitpaulk has quit [Ping timeout: 240 seconds]
<Papierkorb> is that new? #1234
<DeBot_> https://github.com/crystal-lang/crystal/pull/1234 (Fix class name generation for `crystal init`)
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <twharmon> @maiha_twitter Thanks. It just seems this isn't a good idea... Suppose I need to require 30+ external files. Wouldn't there be some name spacing issues? With PHP, Go, Node, etc., required/included/imported files/packages can only be used in the file they are required in. This is convenient because one doesn't have to worry about variable/function names colliding.
<Papierkorb> twharmon, which is actually the biggest benefit: You don't have name collisions. In every file, all symbols are exactly the same. No "relearning" required. You know what you have
<Papierkorb> twharmon, also you usually don't have to "require 30+ external files". 1) You have one central file (e.g., the "main file") where you require stuff 2) You can use * and ** globbing, which significantly reduces the annoyance
rohitpaulk has joined #crystal-lang
<Papierkorb> twharmon, You don't have name collisions because you use modules as namespaces. So say you have a user model, and a user importer. that'd be `Model::User` and `Importer::User`. With import, you'd be inclined to have `Model::UserModel` and `Importer::UserImporter`. I always hated this in Java, it's just spam for something you already know.
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <pnloyd> What about for libs/shards? Does requiring "recursive"?
<FromGitter> <pnloyd> Damn gitter auto sends.. I mean do you get everything your required target can see as well? I don't understand how collisions couldn't be a concern with very large programs/libs, even for module names.
<Papierkorb> shards require their own files in their main file, named after the shard. Shards put everything into their own namespace.
<Papierkorb> pnloyd, practice showed that collisions are a non-issue. You know what the module path to a symbol is by just looking at the file browser.
<FromGitter> <pnloyd> Ok so then the lib "shards" modules and friends are all namespaced to the name of that shard then?
<Papierkorb> By convention, yes.
<FromGitter> <pnloyd> Ok that seems reasonable/safe
<FromGitter> <pnloyd> The docs could probably benefit from discussing convention more in requiring and other areas I think.
<jsn-> it's basically yet another design decision fully copied from ruby, there are hundreds of them. there seems to be little use in discussing all of the in docs
<Papierkorb> Many newcomers, well at least who ask in here, seem to have no past with Ruby, so that argument doesn't work
<oprypin> jsn-, certainly you're not suggesting that docs are fine to assume familiarity with Ruby?
<jsn-> i kinda am, at least it was my assumption that for now well-understood things inherited from ruby are not a priority for docs, given limited resources and all
<jsn-> also, i'm not sure how the discussion of this issue should look. afaiu, "require" doesn't actually "import" anything at all into the file calling "require", it just that the requireed file is allowed to define globals, no?
<Papierkorb> all global symbols of the required file(s) are imported into the global scope
<oprypin> jsn-, no, you can indeed imagine `require` as pasting the contents of the file into the one big compilation unit
<jsn-> oprypin, no, you really can't, local variables are not visible in the caller
<oprypin> you're correct. that is news to me.
<jsn-> yeah, i did an experiment about that just now, was actually surprised that def-s are global (but i think the book mentions that in passing)
<jsn-> so, nothing is "imported", just some globals may (or may not) be defined; i think that the book is reasonably clear about it as it is
<oprypin> there is also a concept of file-private things so yeah, files are a bit more isolated than i had any right to think
<jsn-> but i'm, of course, spoiled by ruby, so perhaps it's my bias
<Papierkorb> I don't think the docs have to cater to people new to programming. But at this point, everyone trying Crystal already knows at least one other language, and if they're legit confused, it's a docs bug. Though adding a sample snippet in those cases could already help
<jsn-> i also did an experiment on ruby now, btw, and was surprised for the second time that def-s are global in ruby too
<Papierkorb> Never used `Array()`?
<jsn-> well, capitalized were kinda expected to behave like constants, so it was kinda expected
<FromGitter> <krypton97> Are `__DIR__` and `__FILE__` all the macros that crystal supports?
<Papierkorb> ?
<Papierkorb> you mean magic constants?
<FromGitter> <krypton97> yeah
<Papierkorb> there's also __LINE__ and __END_LINE__
<FromGitter> <krypton97> It would be nice to have `__OS__`, `__DATE__` , `__TIME__` too
<FromGitter> <krypton97> yeah, forgot about line and end_line
<oprypin> __OS__ makes no sense though
<jsn-> way to screw reproducible builds :)
_whitelogger has joined #crystal-lang
<FromGitter> <krypton97> What would be an workaround to find out if I'm on linux or apple?
<Papierkorb> `{% if flag?(:darwin) %}`
<FromGitter> <Rinkana> Flags
<FromGitter> <krypton97> nvm, thank
<FromGitter> <krypton97> s
<FromGitter> <Rinkana> Hmm, does the `abstract` keyword do anything for structs? Seeing as this does not work: https://play.crystal-lang.org/#/r/2xuh
<oprypin> Rinkana, hard to say if it's a bug. the fix is to not use `getter` in the abstract struct because that also defines an instance variable
<watzon> It is possible to have a method accept another method as a param right?
<Papierkorb> That'd be a `Proc`
<watzon> Basically instead of using a block just give it a method to call
<FromGitter> <krypton97> are you talking bout callbacks?
<Papierkorb> A block is the correct solution though watzon
<oprypin> or this, lol https://carc.in/#/r/2xul
<Papierkorb> watzon: as () are optional, you can't "just pass a method". You have to pass as Proc, but a block is the correct solution in 95% of the time
<watzon> Ok I gotcha
<watzon> I'm basically just trying to keep from doing this over and over `cmd "start" { |msg, params| start_command msg, params }`
<watzon> cmd is being called multiple times with the same block, just a different method
<oprypin> Rinkana, by the way, the minimal example is this https://carc.in/#/r/2xun
<oprypin> Rinkana, the expected solution is probably this https://carc.in/#/r/2xuo
<oprypin> the gist of it is that subclasses should not rely on base classes instance variables
<FromGitter> <Rinkana> Hmm, you'd think that the init methods would not be checked for abstract classes.
<FromGitter> <Rinkana> But for now i've made them nilable and raise within the default init method
<oprypin> if they weren't checked, you'd still be relying on instance variables of the base class which is always a hack
<oprypin> i think this was discussed and considered intentional
<oprypin> if GitHub had a way to see all my past comments, I'd be able to find the discussion. alas.
<oprypin> Rinkana, no, that's terrible to do. i showed you the right way just now.
<FromGitter> <Rinkana> I can't use that method, the instance vars are set during parsing from a file. They are not set as parameters
<oprypin> well if not then they truly are nilable and your example did not have a point
<oprypin> if you're doing the parsing during initialize, as your example showed, then you definitely can use this method
<FromGitter> <krypton97> took a look on the docs and using blocks seems to be much much better than procs hehe
<FromGitter> <Rinkana> Well, the whole point of the object was to parse a file into a struct. But when that parsing fails it should raise and not allow nil values
<Papierkorb> Rinkana, don't parse in the #initialize. Consider using a class intead.
<oprypin> wut
<oprypin> Rinkana, what I showed you passes all your requirements. I'm still not sure what problem you seem to be dissatisfied with
<FromGitter> <Rinkana> Hmm, let me write an extended example
<jsn-> watzon, is start_command a method defined on the same instance as cmd?
<watzon> `cmd` is an inherited method, but yes they do exist in the same instance
<jsn-> not sure, something like .cmd("start", &.start_command) probably should be possible, perhaps?
<oprypin> no
<oprypin> &.foo is always equivalent to {|x| x.foo}
<jsn-> right
<oprypin> hmmmmmmmmm
<jsn-> well, you could have a macro :))
<oprypin> oh yeah, that
<oprypin> &.foo should be equivalent to {|x,*y| x.foo(*y)}
<oprypin> then we can do [1,2,3].reduce &.+
<Papierkorb> Well, but what should happen here? `&.foo(1).bar`
<jsn-> cmd() should yield self, msg, params
<jsn-> then it will be chainable
<jsn-> not chainable, but usable with cmd("start", &.start_command)
<jsn-> or, if you can't change cmd() behaviour, a macro seems like a perfectly fine approach to me
<watzon> Wait I was wrong, that solution would almost work but `cmd` is actually being included from a module
<watzon> Damn
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<watzon> Here's the file in question in case anyone cares to take a look
<watzon> Definitely not the prettiest code yet
<jsn-> oprypin, wtf, [1, 2, 3].reduce(&.+)
<jsn-> doesn't work
<jsn-> ah, so your "should" means "should be, but now it isn't"?
<oprypin> yes
<jsn-> watzon, so, what's the hold up? macro do_cmd(command, handler) cmd {{command}} { |msg, params| {{handler}} msg, params } end should do the trick, i think?
<oprypin> handler can possibly be {{yield}}
<FromGitter> <GurgDev_twitter> What's the easiest way to download the HTML pages for the Crystal lang docs and API?
<watzon> I'm heading to bed now, but I'll try that out in the morning. Thanks jsn-
<FromGitter> <GurgDev_twitter> about to get on a long flight with no Wi-Fi
<oprypin> GurgDev_twitter, generate them locally
<FromGitter> <GurgDev_twitter> Do I need to clone the Crystal source for that or can I get away with just the binaries?
<oprypin> source
<oprypin> it's 2 separate processes, too, so a bit complicated
<oprypin> let me try to handle that for you
<FromGitter> <Rinkana> Alright, this is a super basic example: https://play.crystal-lang.org/#/r/2xwy . I know it's wrong but it should get the idea over.
<FromGitter> <bew> @GurgDev_twitter for the docs, get the content at https://github.com/crystal-lang/crystal-book/
<FromGitter> <bew> For the api, get the sources of Crystal and generate the pages with `crystal doc`
<FromGitter> <GurgDev_twitter> Thanks! Now I have some entertaining work for this six hour plane ride.
<FromGitter> <bew> 👍
<FromGitter> <GurgDev_twitter> With some luck, I might have library request #1 mostly done by the time I land.
<oprypin> GurgDev_twitter, https://pryp.in/crystal/api.zip
<oprypin> and gonna try to get a pdf up
<FromGitter> <GurgDev_twitter> 👍
<FromGitter> <bew> Pdf of the gitbook?
<oprypin> yeah
<oprypin> pdf of api would be quite useless
<oprypin> hahaha generating api docs requires calibre and installing 515MB of packages
<FromGitter> <bew> Wut, why?
<oprypin> i'm sorry, I meant PDF
hightower2 has joined #crystal-lang
<FromGitter> <bew> 500M of pdf Oo
<FromGitter> <GrgDev> I got a moment of WiFi, cloned the crystal repo, tried running `crystal doc` and hit an error
<jsn-> bew :) not "s/packages/pdf/", but "s/api docs/pdf/", perhaps
<oprypin> GurgDev_twitter, well i put up those docs anyway at the link above
<FromGitter> <GrgDev> ``` ⏎ ZERO = '\0'`````` [https://gitter.im/crystal-lang/crystal?at=59ec8228f7299e8f531a302e]
<FromGitter> <GrgDev> but I saw the zip, so thank you
<oprypin> GrgDev, actually need to run `make doc`
<FromGitter> <GrgDev> oh
<FromGitter> <bew> Ah right ><
<FromGitter> <GrgDev> Huh, airport wifi seems to be specifically blocking ssh connections but not https connections
<oprypin> or html but page switching doesnt work unless you run a local http server on it https://pryp.in/crystal/doc.zip
<FromGitter> <GrgDev> Thanks so much for helping oprypin
<FromGitter> <faustinoaq> > allright, is there any other (formal) manas person around here apart form asterite like at all in the past months? ⏎ ⏎ @monouser7dig Try Google Groups (https://groups.google.com/forum/#!forum/crystal-lang), They use the mailing list, more often than Gitter/ICR, maybe to avoid procrastination 😅
hightower2 has quit [Ping timeout: 248 seconds]
<FromGitter> <twharmon> Are there any current, working examples a basic websocket server? I can get things to work fine with Kemal, but I'd like to get it working first without Kemal.
<oprypin> twharmon, wow it's actuallly impossible to find info
<oprypin> it's certainly related to HTTP::WebSocketHandler somehow
<jsn-> google brings https://groups.google.com/forum/#!topic/crystal-lang/XT1NIwExhJs , but it's really old
<FromGitter> <twharmon> I looked through the docs on HTTP::WebSocket and HTTP::WebSocketHandler, but I was unable to get a basic example working. I also looked through Kemal's websocket.cr and websocket_handler.cr but still couldn't get anything to work. Was getting this error: `Connection refused (Errno)`
<jsn-> twharmon, well, my example from the link above seems to work without problems
<oprypin> twharmon, cobbled together a few examples without understranding or trying them out, but hopefully it helps. https://carc.in/#/r/2xx4
<oprypin> this is supposed to be an echo server
<oprypin> jsn-, better do my example because that one accesses an instance variable or something
<jsn-> well, i just used the code from the old google groops post
<FromGitter> <krypton97> Nice code example oprypin
<FromGitter> <krypton97> Crysyal seems to have a better stdlib even than go
<FromGitter> <krypton97> Crystal*
<Yxhuvud> is go known for having a good stdlib?
hightower2 has joined #crystal-lang
<oprypin> yes
Groogy has joined #crystal-lang
<FromGitter> <krypton97> I'd say so..and it's also very good documented ;)
<FromGitter> <krypton97> https://github.com/google/grumpy
<FromGitter> <krypton97> Looks interesting, but I guess it has some limitations..
claudiuinberlin has joined #crystal-lang
<Papierkorb> Can you run .dylib's on Mac like you can run .so's on Linux?
rohitpaulk has joined #crystal-lang
<FromGitter> <kornel_gora_twitter> I would like to start learning crystal.Have this language future and will more jobs??Its good choice for first programming language for making web stuff??
<FromGitter> <twharmon> The Crystal blog said they aim for version 1.0 by the end of this year. Are they on track to do this?
<Groogy> don't think so
koruneru has joined #crystal-lang
<koruneru> I would like to start learning crystal.Have this language future and will more jobs??Its good choice for first programming language for making web stuff??
koruneru has quit [Quit: Page closed]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
Groogy has quit [Quit: WeeChat 1.9]
snsei has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <unreadable> If you're looking to learn a crystal for a job, I won't recommand it for now
<FromGitter> <unreadable> As a first language I'd recommand c/c++
<FromGitter> <unreadable> And yes, it's great for web programming
<FromGitter> <unreadable> Std lib got it all
<Papierkorb> Crystal that is, C/C++ isn't for webdev
<FromGitter> <unreadable> Well, programming langauges that requires memory management aren't for webdev
<FromGitter> <unreadable> I was referring to crystal, not c++ though..
<FromGitter> <monouser7dig> @faustinoaq ah ok, was just wondering if there are some more people that push or if it's as half dead as it seems round here :D
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
astronavt has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <jasonrobot> Hey quick question: is there a way to get database results in a NamedTuple or a Hash? I'm working with ResultSet, and just kinda relying on the columns to come back in the right order. Maybe I'm missing some handy method from DB or something
<FromGitter> <fridgerator> You can use a class or struct and `DB.mapping`
astronavt has left #crystal-lang ["Leaving..."]
hightower4 has joined #crystal-lang
<FromGitter> <jasonrobot> I was doing that at first, but opted to do it manually in the end. Its a bit of a learning project I'm working on, and I need the SQL practice.
hightower3 has quit [Ping timeout: 240 seconds]
hightower2 has joined #crystal-lang
<FromGitter> <jasonrobot> I was thinking of doing something like how the JSON module does it, where you have the 'Any' type, and everything gets packed into a key-value structure, just making sure I wasnt re-writing something that exists already
hightower4 has quit [Ping timeout: 260 seconds]
<FromGitter> <fridgerator> I'm not aware of anything 👍
snsei_ has joined #crystal-lang
<FromGitter> <jasonrobot> sweet, well off I go then :-D
snsei has quit [Ping timeout: 255 seconds]
hightower3 has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
hightower2 has quit [Ping timeout: 260 seconds]
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 248 seconds]
<FromGitter> <kornel_gora_twitter> ok i will go for crystal than ruby and learn it
<FromGitter> <kornel_gora_twitter> what framwork is better for crystal amber or kemal ??
<oprypin> kornel_gora_twitter, Crystal is NOT good for a first programming language, and it will also have no jobs for the foreseeable future. As much as I like it, it does not match what you're looking for
<FromGitter> <jasonrobot> ruby is a better first language, just because its more established and theres more learning resources. Plus crystal is a very small jump from knowing ruby
<FromGitter> <fridgerator> would also recommend learning ruby
<FromGitter> <jasonrobot> but ya, python java and C/C++ are pretty common 1st languages these days
<FromGitter> <gwerbin> funny i was just wondering, "is it worth trying crystal if i don't know a lot of ruby"
<FromGitter> <jasonrobot> that's what I'm doing right now
<oprypin> i don't think the Ruby recommendations here are representative of the general populace
<FromGitter> <gwerbin> i already know python and r well. i have a smattering of experience in ruby, perl, awk, javascript, common lisp, bash/zsh, and good old vimscript
<FromGitter> <jasonrobot> its fun, but probably not the most relevant thing. I really should be doing php, but eff that
<FromGitter> <gwerbin> what does crystal have to offer that all the other hip compiled imperative hackernews-favored languages out there don't? (go, rust, nim, d)
<Papierkorb> Compared to Go, it's actually a good language. Compared with Rust, the memory management is much easier.
<oprypin> agree
<FromGitter> <gwerbin> i'll take that
<FromGitter> <gwerbin> yeah i keep seeing how go is like, bad on purpose
snsei_ has joined #crystal-lang
<Papierkorb> It's not bad. It's a system programming language. And that shows. Which is how it should be.
<FromGitter> <gwerbin> so then what is crystal's niche?
<FromGitter> <gwerbin> i see all these cool new command line tools in Go, and they're all blazing fast to compile and run
<oprypin> gwerbin, i mean obviously it attracts people who want ruby but also want fast. so web dev i guess :/
<FromGitter> <gwerbin> and just seem way less crufty than their C equivalents. i can actually read/follow Go
<Papierkorb> Surely not only webdev
<FromGitter> <gwerbin> hey, well im a data scientist and i often wish Matplotlib was ported to Ruby, not Python
<FromGitter> <gwerbin> i love how expressive Ruby is
<FromGitter> <gwerbin> as soon as i started learning Ruby i got real sick of Python
rohitpaulk has quit [Ping timeout: 240 seconds]
<Papierkorb> Crystal is fast, but expressive. We sure trade some performance for expressiveness, but overall, we keep it in check
snsei has quit [Ping timeout: 255 seconds]
<Papierkorb> So it's not like in Ruby where "This new feature will slow everything down by 5%" and everyone applauds
<FromGitter> <asterite> Greg: you should try Julia, probably a better fit
<FromGitter> <monouser7dig> i use a terminal written in rust and had segfaults :D c bindings or sth. like that :D
<FromGitter> <faustinoaq> Yeah, Julia is very suitable for a data scientist 👍 https://julialang.org/
<FromGitter> <gwerbin> faustinoaq i can't wait to convince my boss to let me use julia
<FromGitter> <gwerbin> multiple dispatch and type hinting in a math-first language? feelsgoodman.jpeg
DTZUZU has quit [Ping timeout: 255 seconds]
<FromGitter> <faustinoaq> Yeah, Julia & Crystal are just like friends, is pretty nice, Also Ivo Balbaert (the author of multiples Julia's books) is writing a book about crystal https://pragprog.com/book/crystal/crystal 😄
<FromGitter> <gwerbin> really now
<FromGitter> <gwerbin> that's cool
<FromGitter> <pnloyd> @oprypin , regarding CrSFML. Am I understandably correctly that that voidcsfml compiles sfml source into resulting libs that can function independently of SFML libs?
<oprypin> pnloyd, voidcsfml uses cmake and u can configure it in many different ways, including statically compiled. by default, no.
DTZUZU has joined #crystal-lang
<FromGitter> <pnloyd> @oprypin, well my confusion is resulting from the example programs continuing to run after I renamed the dir containing SFML libs. But I have also installed them globally via apt-get so maybe that's the explanation. But would voidcsfml magically find globally installed libs if it was built against a different copy? I obviously need to learn more about linking :-/
<oprypin> pnloyd, yes, on linux globally installed libs are always there just waiting to be picked up
<oprypin> linking happens against just the file name, i guess
<FromGitter> <pnloyd> @opensas, Ok so after I removed globally installed SFML examples fail to compile so that's confirmed. What about if I want to voidcsfml to link against SFML libs I have in an arbitrary folder? Is there an easy solution for that? I apologize for being so ignorant on such common topics :-/
<FromGitter> <pnloyd> Right now I have the SFML folder in the exact location is was relative to voidcsfml when I originally built it with cmake.
<FromGitter> <pnloyd> But linker does not appear to find the SFML libs
<oprypin> pnloyd, > If SFML can't be found, make sure it is installed and consult the CMake options section.
<FromGitter> <faustinoaq> @drosehn I saw the video you shared (https://gitter.im/crystal-lang/crystal?at=59ebd210f7299e8f5317dde2), very nice video 👍 ⏎ ⏎ @asterite, RX14 Related to above video, Would be possible to create Refactoring tools for Crystal easily ? 😅
<RX14> probably
DTZUZO has quit [Ping timeout: 248 seconds]
<RX14> crystal's availabl;e as a library
<RX14> and it knows what's going on
<RX14> and it's nice and openly licensed
<FromGitter> <gwerbin> language server protocol all the way!
<FromGitter> <unreadable> I'm late to the party, but I can't find a better first language than c/c++. Once you know that, it'll be much easier to understand other languages
<FromGitter> <unreadable> You might hate it, but it's solid as a rock
<oprypin> unreadable, just no
<oprypin> especially if you phrase it as "c/c++"
<FromGitter> <unreadable> That's my opinion
<FromGitter> <unreadable> You keep yours
<FromGitter> <faustinoaq> Yeah, LSP is the way to go, ST3 have pretty good support via plugin https://github.com/tomv564/LSP http://langserver.org/ ⏎ ⏎ RX14, I tried transformer_example.cr (https://github.com/crystal-lang/crystal/blob/master/samples/compiler/transformer_example.cr) & visitor_example.cr (https://github.com/crystal-lang/crystal/blob/master/samples/compiler/visitor_example.cr) Would be this a way to rename methods
<FromGitter> ... or symbols ? Maybe a tool like `crystal tool rename`
<FromGitter> <unreadable> Where can I find that rust terminal. I'm actually pretty interested in that?
<FromGitter> <unreadable> Or is it that?
<FromGitter> <unreadable> https://github.com/jwilm/alacritty
<FromGitter> <pnloyd> @oprypin, you can see my entire process in this screenshot. https://i.imgur.com/wx0PV3D.png. Does anything odd stand out to you?
<FromGitter> <pnloyd> The error in the terminal is producted from `crystal shapes.cr`
<oprypin> pnloyd, LD_LIBRARY_PATH and LIBRARY_PATH need to be the same and contain both paths
<FromGitter> <pnloyd> @oprypin, as in.. they are both a path that is a parent folder to voidcsfml and sfml lib folders?
<oprypin> pnloyd, no, it needs to contain two paths separated by : as shown at the link
<FromGitter> <pnloyd> Woops! Got it thanks.
braidn[m] has quit [Ping timeout: 255 seconds]
dtcristo has quit [Ping timeout: 240 seconds]
sija[m] has quit [Ping timeout: 240 seconds]
tybee[m] has quit [Ping timeout: 246 seconds]
kp666[m] has quit [Ping timeout: 246 seconds]
cptaffe has quit [Ping timeout: 240 seconds]
watzon has quit [Ping timeout: 248 seconds]
thelonelyghost has quit [Ping timeout: 255 seconds]
TheGillies has quit [Ping timeout: 255 seconds]
olbat[m] has quit [Ping timeout: 240 seconds]
Renich has quit [Ping timeout: 240 seconds]
byteflame has quit [Ping timeout: 264 seconds]
weston_[m] has quit [Ping timeout: 276 seconds]
jplatte has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
snsei_ has quit [Read error: Connection reset by peer]
balduin has joined #crystal-lang
balduin has left #crystal-lang [#crystal-lang]
<FromGitter> <pnloyd> @oprypin, I wiped out what I had and did a clean build from scratch. Seems like the same error even with paths set (correctly this time I think?). https://i.imgur.com/KeGZqmo.png
snsei_ has joined #crystal-lang
<FromGitter> <bew> @pnloyd repost the new link, IRC users don't get edits on gitter like you did for the link
snsei has quit [Ping timeout: 255 seconds]
<FromGitter> <pnloyd> @bew, I'm confused. The link I posted was different/new, no?
<oprypin> pnloyd, the fact that you have the sfml libraries with .a and -d prefixes makes me think that you downloaded them prebuilt, build with/for a different compiler
<FromGitter> <monouser7dig> yeah its alacritty, not sure if it actually makes sense to run it but yeah...works mostly and is fun to watch
<FromGitter> <monouser7dig> I know people who say cpp is easy, cause they do not know cpp :D I'd choose java or c as a first language, then ruby is easier and from there on ...
Ven has joined #crystal-lang
<FromGitter> <bew> @pnloyd hmm I'm not sure now, first time I opened your link it was the same as before (your first link), then I checked to be sure, reopened it and it was a different img, so I thought you edited your message, so I warned you that IRC users don't see edits. But maybe I did a mistake and opened the wrong link the first time, we'll never know :p
<FromGitter> <pnloyd> @oprypin, Yes they're just the main ones offered up on sfml-dev.org download page. It says "GCC - 64-bit". By different compiler, you don't mean a different version of GCC and a completely different compiler all together. `man cc` indicates GCC as well on my system.
Ven is now known as Guest28087
<FromGitter> <pnloyd> @bew, haha I wan't even aware you could edit your messages. Seems like a strange/odd feature for chat..
<FromGitter> <bew> yeah on gitter, once you posted a message, you have 5 minutes to edit it (fix typo, rephrase, ..)
<FromGitter> <Sija> @unreadable c++? better try brainfuck ;) but seriously, c++ has (IMO) pretty fucked up OO model - like multiple inheritance for instance, I’d doubt it’s a good language to start with...
<FromGitter> <bew> ⬆️ 👍
<FromGitter> <pnloyd> @bew, Ya I just had the opportunity to use it for the first time.. I suppose that is useful as it's easy to make typos or phrase things in odd ways when communicating technical concepts.
<FromGitter> <bew> exactly, but our bridge from gitter to IRC passes messages, but not edits, so if you need to make a *important* edit that they must see, you should not edit and repost a new message, or send a new message to say what you changed
<oprypin> pnloyd, as i was saying, different compiler. please just build SFML from source also.
<FromGitter> <pnloyd> @bew Ahh wow that's a big gotcha, thanks for the heads up.
<oprypin> that sfml was compiled with a compiler not using C++11, while yours is
<FromGitter> <pnloyd> @oprypin, Thanks I will do that.
olbat[m] has joined #crystal-lang
<oprypin> different gcc versions most likely, yes
<FromGitter> <pnloyd> Ok so same compiler but different language target is not ok?
<oprypin> pnloyd, gcc has had incompatible ABI changes due to new standard requirements
<FromGitter> <pnloyd> Or possibly compiler version. Kinda could be one of many things kind of situation so we just build everything with one compiler to make sure everything is lining up correctly?
<oprypin> pnloyd, yes
<FromGitter> <bew> is there a place where I can learn about the ABI used by the compiler? (I'm not sure about what I'm taking about though)
<FromGitter> <pnloyd> Gotcha, thanks this is helping my understanding a lot. My gcc, c, c++ knowledge is very shallow.
<oprypin> bew, by "the" compiler?
<FromGitter> <bew> crystal compiler
<oprypin> bew, oh. well it does not have an ABI, everything is compiled from source. And it uses the C ABI for linking and exporting stuff
<FromGitter> <bew> (sorry for possible mis-read, your message made me think about that)
<FromGitter> <bew> while looking at how exception works yesterday, I dived into __crystal_personality which is doing very low level stuff with the stack to get some informations, so I think it has to deal with the ABI we use, and would like to learn more about that
braidn[m] has joined #crystal-lang
byteflame has joined #crystal-lang
jplatte has joined #crystal-lang
TheGillies has joined #crystal-lang
tybee[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
thelonelyghost has joined #crystal-lang
dtcristo has joined #crystal-lang
kp666[m] has joined #crystal-lang
watzon has joined #crystal-lang
Renich has joined #crystal-lang
weston_[m] has joined #crystal-lang
sija[m] has joined #crystal-lang
<FromGitter> <unreadable> @Sija I actually started with C because is was much easier. Later on moved to learning C++. Now I only use it at the university, nothing more..
<FromGitter> <unreadable> I didn't say I like it though
DTZUZU has quit [Quit: WeeChat 1.9]
Groogy has joined #crystal-lang
<FromGitter> <Sija> yep, I don’t know many ppl who do ;)
<FromGitter> <Sija> C is useful to learn IMO for its ubiquity and speed. C++ though is failed experiment in OO, unlike lets say Objective-C which married OO approach and dynamic introspection abilities with speed and ABI compatibility of C and achieved pretty sweet spot between compiled and runtime - C++ on the other hand came closer to it only in recent yrs with C++11 standard.
snsei_ has quit [Remote host closed the connection]
<FromGitter> <monouser7dig> Within C++, there is a much smaller and cleaner language struggling to get out.
<FromGitter> <monouser7dig> Bjarne Stroustrup
<FromGitter> <monouser7dig> just because there is so much cpp out there it is worth to learn
<RX14> the problem is that that smaller and cleaner language is different depending on your opinion
<RX14> so it's really not
<RX14> you'll end up having to deal with every feature eventually anyway
<RX14> so C++ sucks
snsei has joined #crystal-lang
<FromGitter> <Sija> for me same goes for Java
<FromGitter> <Sija> lots of stuff was written in Java, yet I’m not sold on learning it just because of that
<FromGitter> <unreadable> I don't learn it because Oracle :X
<FromGitter> <unreadable> was thinking on c#, at my previous internship there was some need in it
<RX14> Java's simple though
<RX14> you can learn all of java in like
<RX14> a day
<FromGitter> <Sija> I’d say it’s mainly an academic language, whatever it’s worth
<RX14> @unreadable just use openjdk
<RX14> @Sija java? an academic language? no way
<RX14> java's one of the top commercially used languages
<RX14> because it's so common
<RX14> it's got such good tooling
<FromGitter> <monouser7dig> I always feel like I need to learn+ use kotlin when I use java but did not yet make it :D
<RX14> and it's pretty damn fast
<FromGitter> <Sija> @RX14 yeah, it’s because they teach it at unis ;)
<RX14> yes because it's so well used
<RX14> and because it's so simple
<RX14> not because it's an academic language
<RX14> it went industry -> uni not the other way around
<RX14> haskell is an "academic language"
<FromGitter> <unreadable> RX14 openjdk??
<RX14> java is an open source language
<RX14> the oracle jdk is a few select patches on top of openjdk
<RX14> which is open source
mjblack has quit [Ping timeout: 246 seconds]
<RX14> you can use java and never support oracle at all
<FromGitter> <unreadable> Does that JIT really make Java that fast or it's more than that?
<RX14> what do you mean by "More than that"
<RX14> it's a simple language which is fairly easy to optimize
<RX14> (no pointers, no aliasing, not much complexity)
<RX14> and so a good JIT, which the JVM certainly has a lot lot lot of optimization work on does a really good job
<RX14> it's not exactly gcc, but it does get very close
<FromGitter> <unreadable> that should be
<FromGitter> <unreadable> maybe I'll ditch it one day, on techempower benchmarks seems to lead
<FromGitter> <sdogruyol> java is good enough
<FromGitter> <sdogruyol> (I don't like to verbosity though)
<RX14> i don't enjoy it
<RX14> i respect java
<RX14> as a solid workhorse and productive language
<RX14> java 8 is a language I could get stuff done in much faster than crystal
<FromGitter> <monouser7dig> java an no pointers lol?
<RX14> java 8 isn't even that bad
<RX14> yeah, why do you need pointers?
<FromGitter> <monouser7dig> you've got a pointer to everything
<FromGitter> <monouser7dig> all on the heap
<RX14> pointers in crystal are very rarely used
<FromGitter> <monouser7dig> that is actually what makes parts of java slow if you overuse objects
claudiuinberlin has quit [Read error: Connection reset by peer]
<oprypin> pnloyd, did it finally work?
alex`` has quit [Ping timeout: 264 seconds]
<FromGitter> <pnloyd> @oprypin, took a break to eat. I'll try building SFML now I'll let you know how it goes.
snsei has quit [Remote host closed the connection]
<Papierkorb> .. why is Socket::IPAddress#port suddenly a Int32?#
<Papierkorb> That is like, impossible to occur, and on the other hand, just wrong
<oprypin> Papierkorb, i dont see any downside
<Papierkorb> Except that -4 or 1_234_324_234 are suddenly valid ports? Me neither
<Papierkorb> Fail early and fast, we don't have to ask the OS if those numbers make any sense, we know they don't
<oprypin> ok add a check
<Papierkorb> No? Just use the correct data type?
<oprypin> this is future-proof mkay?
<Papierkorb> Since when are run-time checks better than compile time checks
<Papierkorb> ... huh
<Papierkorb> So when exactly can I expect port -1337 to work?
<oprypin> basically all these int32s are due to lack of #2995
<DeBot_> https://github.com/crystal-lang/crystal/issues/2995 (Untyped number literals)
<Papierkorb> That's not an excuse to break an previously correct API
<watzon> Anyone else feel like `HTTP::Client` should allow you to set headers on the client itself that get passed in to every request? Or can it already and I'm just stupid?
<Papierkorb> watzon: Set them in a `HTTP::Client#before_request` block
<watzon> Well there you go
<watzon> Stupid it is lol
<FromGitter> <bew> (You're not stupid!)
Guest28087 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mjblack has joined #crystal-lang
<FromGitter> <pnloyd> @oprypin, building from source works.
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<rkeene> The TclQuadCode stuff was real interesting -- it successfully compiles much Tcl to machine code using a LOT of type inference
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <Qwerp-Derp> Hey, so I have a piece of code like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59ed29d101110b7231ead526]
<FromGitter> <Qwerp-Derp> Which errors because `@foo` isn’t defined in B’s `initialize`, this making it nilable
<FromGitter> <Qwerp-Derp> Is there any way to fix this without doing `@foo = 1` in B’s initialize method?
<watzon> lol thanks bew
_whitelogger has joined #crystal-lang
<jsn-> Qwerp-Derp, call "super"?
<FromGitter> <iambudi> Yes call super() before @baz = 1