<rocx>
api question: in the case of crystal, is it better to return a nilable type or to just return an empty array?
<FromGitter>
<Blacksmoke16> well if the api endpoint is expected to return an array of objects and there are none, it should be an empty array
ua has quit [Ping timeout: 252 seconds]
<FromGitter>
<Blacksmoke16> assuming my api you mean like JSON api endpoint?
<rocx>
mainly as in a crystal method, not like a json endpoint.
<FromGitter>
<Blacksmoke16> ah, depends i guess then
<FromGitter>
<Blacksmoke16> got an example?
ua has joined #crystal-lang
<rocx>
yeah. i have a method to "find_things()" that returns an array of things that match a particular requirement. if nothing matches that requirement, guess it'd be better to return an empty array?
<rocx>
asking because the standard library's use of this stuff is a tad inconsistent.
<FromGitter>
<Blacksmoke16> either would be ok, depends on your implementation
<rocx>
tl;dr "in the end it doesn't really matter lol"
<FromGitter>
<Blacksmoke16> pretty much, six in one half a dozen in the other
<FromGitter>
<Blacksmoke16> like if you're iterating over the response of `find_things` then an empty array could be safer
<rocx>
reading up on such "best practices", most people seem to say "always use an empty array" but then those languages don't seem to deal with an equivalent to an Optional<T> as much as crystal.
<FromGitter>
<Blacksmoke16> or just return if response is nil
<FromGitter>
<Blacksmoke16> id go with empty array, would prob be easier to handle vs nil
<rocx>
fair 'nough. figured i'd ask about what the language/community's preference on the subject would be.
ua has quit [Ping timeout: 268 seconds]
ua has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
woodruffw has quit [Quit: And then he took off.]
woodruffw has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
lucasb has quit [Quit: Connection closed for inactivity]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 250 seconds]
fifr has quit [Ping timeout: 250 seconds]
fifr has joined #crystal-lang
akaiiro has joined #crystal-lang
sagax has quit [Ping timeout: 250 seconds]
sagax has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<proyb6> Petter Tseng's Ruby on AOC2018 Day 3 is impressive
<FromGitter>
<sdogruyol> Morning and have an awesome week everyone 👋
<FromGitter>
<sdogruyol> @sagax congrats
<sagax>
hi
<sagax>
all
<FromGitter>
<sdogruyol> Hey @sagax
flxy has quit [Ping timeout: 240 seconds]
<FromGitter>
<girng> hi sagax!
DTZUZO has joined #crystal-lang
<livcd>
Did you guys see Memex. Was also impressive.
<FromGitter>
<KevinSjoberg> Is it possible to generate a hash from an array as in Ruby?
<FromGitter>
<KevinSjoberg> `Hash[[["key", "value"]]]` but in Crystal.
<FromGitter>
<asterite> Invoke to_h
<FromGitter>
<KevinSjoberg> @asterite ah, of course. Couldn't see it in the docs, so never tried it.
<FromGitter>
<asterite> It's in Enumerable
<FromGitter>
<KevinSjoberg> Thanks! :)
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
<FromGitter>
<proyb6> Team and folks who develops Crystal shards, what do you think about Codacy for a code quality badge for your projects? ⏎ https://www.codacy.com/product ⏎ It's also free for Open Source project
DTZUZO has joined #crystal-lang
<FromGitter>
<vladfaust> @veelenga works on integrating Ameba with Codacy IIRC
<FromGitter>
<ilanusse> I don't see crystal among the supported langs
<FromGitter>
<vladfaust> @livcd I'm not offended at all. If you have your opinion, don't hesitate to share it on GitHub, because for some reason @Sija doesn't consider gitter as a community communication tool
<livcd>
vladfaust: i think it's very unnecessary and unimportant noise. There will always be people that will like the purple color and there will be people that like the new black color. If you want to have any semi-official data you need to have a strict voting system based on some period of time. At the end of the day it does not reaally matter.
<FromGitter>
<vladfaust> It's a "unnecessary and unimportant noise" for those who don't care for the language's future. If you spend some time and read my post, you'll see that such details decrease the adoption. And if it really "doesn't matter" then why Ary, a former core team member, *demands* to revert the PR?
<FromGitter>
<f1refly_gitlab> Probably because it's an unnecessary change and most people oppose change that is done for changes sake
<livcd>
vladfaust: people that care about the most important and complex features are the ones most likely to contribute to Crystal or Crystal's ecosystem not the ones caring about GH's colors.
<livcd>
vladfaust: i did not mean you I meant your avg joe developer
<FromGitter>
<j8r> this color story is taking proportions...
<FromGitter>
<j8r> Personally I don't mind at all :)
<livcd>
I was surprised to find out on reddit. Did not like it at all but dont mind.
<livcd>
vladfaust: For the sake of consistency I think it would be better to look at the purple version of the crystal's log and then make a poll.
<oprypin>
vladfaust, asterite is not a "former" core team member
<FromGitter>
<vladfaust> Also, @livcd who are most likely to contribute to Crystal or Crystal's ecosystem != businesses willing to invest their time onto building apps on Crystal. All they want is enough developers. And this number depends on the language's presence, as I, again, have cleary stated in my post
<FromGitter>
<j8r> @RX14 LoL I've seen your comment before deletion X)
<FromGitter>
<j8r> Me too, I don't give a shit. I like most colors, except maybe duck shit color 💩
<livcd>
vladfaust: You cant find a color scheme that's different enough on GH that it would matter really. For the sake of consistency why not wait till 1.0 ?
<FromGitter>
<vladfaust> I'd like to post the @RX14 screenshot so much to show the team's attitude to all this language presence thing
<FromGitter>
<vladfaust> But I will not do it
<RX14>
Really, its a colour, both colours are used to represent the language
<RX14>
I missed the old colour for a while then I got used to it
<RX14>
Who cares
<RX14>
Arguing about pointless shit hurts the language more than branding
<FromGitter>
<vladfaust> But it *is* branding
<FromGitter>
<vladfaust> Branding is what people feel about something.
<FromGitter>
<f1refly_gitlab> @vladfaust To be honest i think an accent color isn't bad at all presentation-wise. I get your consistancy thing, but honestly all black-n-white is kinda boring. Every design guide tells you about choosing your colors carefully, and the shade of purple is pretty cool
<FromGitter>
<f1refly_gitlab> Web 1.0 with black-on-white plaintext would be pretty cool too, but i doubt that many people would see it this way
<FromGitter>
<vladfaust> > Branding is what people feel about something. ⏎ ⏎ And dissonance is the last thing I want people to think about Crystal
<FromGitter>
<vladfaust> @f1refly_gitlab I see what you're saying. But it is already black on the website and in its /media section. If it was blue on the website and purple on GitHub, I would raise the same question
<livcd>
vladfaust: The's com channel fragmentation but that can easily be solved with bridge bots why not to work on that instead ?
<FromGitter>
<vladfaust> Because IRC is *old*. To be on the one wave with newcomers, we must not use *old* things
<FromGitter>
<f1refly_gitlab> Well, what would you think about giving the website some purple accents instead of purging colors entirely?
<livcd>
vladfaust: and you cant bridge from irc to new channels because ?
<FromGitter>
<f1refly_gitlab> IRC is pretty neat actually, I use it exclusively for dev related things when i'm not at work and i'm not exactly old :)
<livcd>
vladfaust: sorry but you are making silly arguments. It's like saying people should stop developing integrations with emacs or vim because they are old and instead focus on VSCode or whatever.
<RX14>
I'm the youngest in the core team and one of the least "hipster" lol
<FromGitter>
<vladfaust> @robin, ⏎ ⏎ > Well, what would you think about giving the website some purple accents instead of purging colors entirely? ⏎ ⏎ I'm in for having an accent color. The issue is that Crystal positions itself as a general-purpose language, and "Crystal" itself is an abstract word. It doesn't have a color other than transparent or black. If we could come to an idea explaining why purple is accent, it
<oprypin>
vladfaust, i think the bigger point here is that you should stop doing things behind the core team's back. i'd say this is not the first time. also remember that you don't have the power to represent the whole community even if you're part of it
<livcd>
You will see a lot more people trying Crystal with at least some basic support of things that people want. Windows support, paralellism etc.
<FromGitter>
<f1refly_gitlab> > If we could come to an idea explaining why purple is accent, it would be great. ⏎ cause it looks nice?
<FromGitter>
<f1refly_gitlab> > Because I don't use IRC ⏎ ⏎ top notch argument you got there
<FromGitter>
<j8r> the branding doesn't matter much at the end, look at C/C++, even Java popularity. Is GO site pretty? Not really
<oprypin>
j8r, that just because money is the bigger factor there. when that's not the case, maybe other factors are not overshadowed anymore
<livcd>
j8r: but they have billion dollar corporations behind them
<FromGitter>
<j8r> totally, that's money
<livcd>
who runs crystahlshards.xyz ? it's down :D
<FromGitter>
<j8r> corporation have ecosystems, projects where they can impose they languages
<FromGitter>
<j8r> Look at Flutter, they bring there "new" Dart language
<FromGitter>
<vladfaust> @f1refly_gitlab, ⏎ ⏎ > top notch argument you got there ⏎ ⏎ You're cutting it from the context. Because I said "I'm okay with IRC staying here, but I'm against IRC and Gitter being the only options." [https://gitter.im/crystal-lang/crystal?at=5c053b66464b6c0fd6849e44]
<FromGitter>
<j8r> @vladfaust everyone is free to create their chans in slack, discord whatever 😏
<FromGitter>
<f1refly_gitlab> We should make a crystal xmpp muc 🤔
<FromGitter>
<j8r> I will make a good project - Crystal client for matrix
<FromGitter>
<vladfaust> > the branding doesn't matter much at the end ⏎ ⏎ You give C/C++ and Java as examples, but they are grandfather languages and people use it because their legacy code is written in these languages. Therefore there jobs and stuff. There are literally no modern projects in the wild who use these old dudes. ⏎ ⏎ Apart from Go, which is still a better alternative to Java. Go and Rust came to the scene
<RX14>
Also, I didn't see the pr before it got merged
<RX14>
Nobody pinged me
<FromGitter>
<f1refly_gitlab> I begun working on an xmpp library but then my actual job more busy and i didn't have enough time to really look into it :/
<FromGitter>
<vladfaust> > everyone is free to create their chans in slack, discord whatever ⏎ ⏎ Chicken-egg problem, newcomers wouldn't join empty channels, and they will stay empty unless the team explicilty supports it (and at least joins)
<RX14>
And I don't think any of the core team were
<FromGitter>
<vladfaust> Imagine a situation when this PR had hundreds of thumb ups, but still the core team didn't know about it. Would you say that community opinion still doesn't overweight?
<RX14>
If the core team don't get to present their view on the pr then the vote isn't well informed is it?
<RX14>
Also, this isn't a democracy
<FromGitter>
<j8r> core team is equally important as community ⏎ Core team needs the community ⏎ Community needs the core team
<FromGitter>
<vladfaust> > Also, this isn't a democracy ⏎ ⏎ Yeah, summing it up with your "don't give shit" comment I finally starting to see the whole picture
<RX14>
If crystal was a democracy we'd have C++
<FromGitter>
<vladfaust> Just remembering this "let all shards depending on dynamic constants die, I don't care" comment
<RX14>
Design needs vision and vision needs leadership
<FromGitter>
<f1refly_gitlab> Theres still the problem that you can't be sure if this is really people interested in the project or just a lynchmob called in from reddit or somewhere
<FromGitter>
<vladfaust> Your vision about the language code is great. It's not about its presence
<FromGitter>
<vladfaust> I've stated it in the post as well
<FromGitter>
<vladfaust> Nobody reads long posts, right
<RX14>
Then bring those arguments to us
<FromGitter>
<vladfaust> Are you kidding me
<FromGitter>
<vladfaust> Should I copypaste my comment here for you to see it?
<FromGitter>
<proyb6> Most developers choose the languages because the market demands?
<FromGitter>
<f1refly_gitlab> Toy languages get chosen because they're fun
<FromGitter>
<f1refly_gitlab> And then they'll get adopted in the industry eventually because many devs know it already
<FromGitter>
<j8r> more importantly, they solve a problem better than others
<FromGitter>
<f1refly_gitlab> Yeah, of course
<FromGitter>
<j8r> Dart is chosen because Flutter, Go because of concurrency, Rust for safety
<FromGitter>
<proyb6> In Asia, PHP, Java, .Net are widely popular
<RX14>
They are everywhere
<RX14>
If you think that they're not you've been reading HN for too long
<FromGitter>
<vladfaust> My statement is that although Crystal itself is great, it's overall presence is poor because of those tiny failures in details. What I want from the team is to take Javascript and VueJS approach in terms of adoption and visual presence.
<FromGitter>
<j8r> I think the best to boot popularity is to have a killer project in Crystal
<FromGitter>
<proyb6> Yeah everywhere, some developers are inexperienced and can't see the benefits in Ruby and Crystal, that's the concern
<FromGitter>
<vladfaust> I don't need those crystaljobs and crystalcommunity forum for myself, I'd love the team to create jobs. and forum. websites
<FromGitter>
<proyb6> A killer project is a concern
gangstacat has quit [Remote host closed the connection]
<RX14>
@vladfsust and we're listening to you
gangstacat has joined #crystal-lang
<RX14>
We're working on the official forum
<RX14>
You just need to bring these discussions to us on the mailing list
<RX14>
Not the github, that's for bugs
<FromGitter>
<vladfaust> WHO USES MAILING LISTS
<RX14>
Not gitter, that's too ephemeral
<FromGitter>
<vladfaust> It's good news indeed, forum is greate
<RX14>
Please calm down, that's why we're working on the official forums
<FromGitter>
<vladfaust> @RX14 is it going to be on Discourse or you're creating a Crystal-engine forum?
<FromGitter>
<f1refly_gitlab> You can use mailing lists on gmail though?
<RX14>
Discourse
<FromGitter>
<Sija> @RX14 nice!
<FromGitter>
<proyb6> @f1refly_gitlab Oh right, I forgot about it
<RX14>
Its not 100% confirmed etc etx
<RX14>
But its probably going to happen in the next week or two
<FromGitter>
<vladfaust> Could you say @RX14 that it was my attemt to launch a forum which made you think about it?
<RX14>
Yes it was
<FromGitter>
<vladfaust> So, you listen to the community
<RX14>
But it would have been less work for you to bring it up directly
<RX14>
Yes I never said we didn't
<oprypin>
you can shout in the forest and say that core team isnt listening
<FromGitter>
<vladfaust> > bring it up directly ⏎ ⏎ To have another stale issue on GitHub? No thanks
<FromGitter>
<vladfaust> And I don't use mailing lists, I'm 22
<FromGitter>
<vladfaust> It's sometimes better to do things than to discuss them indefintely
<FromGitter>
<f1refly_gitlab> > And I don't use mailing lists, I'm 22
<FromGitter>
<f1refly_gitlab> Im 20 and i use mailing lists
<FromGitter>
<f1refly_gitlab> get off your high horse
<RX14>
I'm 19 and I love mailing lists
<RX14>
Ditto
<FromGitter>
<vladfaust> Couldn't you see an irony
<FromGitter>
<vladfaust> Explaining: I'm not saying "I;m modern, you suck". I'm stating that mailing lists is generally an outdated thing
<oprypin>
doesnt give you the right to decide that you're just going to force something else and expect people to be happy
<RX14>
I get that mailing lists arent the best
<FromGitter>
<Sija> @vladfaust yeah, "outdated" because what... email is outdated too?
<FromGitter>
<f1refly_gitlab> Mailing lists as a tool just work(tm) and are universal
<RX14>
But outright using that as an excuse not to talk to the core team is stupid
<FromGitter>
<vladfaust> If the core team used telegrams to communicate because they "just work (TM)" and I didn't want to use them, what am I - stupid?
<oprypin>
then the core team would be stupid
<oprypin>
but you would still be wrong
<FromGitter>
<vladfaust> But it wouldn't be stupid in 20th century, right
<RX14>
Also, we don't use telegrams, email is free and accessible and not too difficult to use
<FromGitter>
<vladfaust> Telegrams are outdated compared to mailing lists, and mailing lists are outdated compared to literally anything we have now
<FromGitter>
<f1refly_gitlab> Telegrams cost money, email doesn't. your analogy is hardly applicable.
<RX14>
Google groups has a web interface that looks half like a forum anyway
<RX14>
Its honestly a terrible argument
<FromGitter>
<proyb6> It's the same as what communication platforms we have experience in and what confidence we have in the products
<RX14>
And Arguing anoint mailing lists is pointless anyway because we're working on replacing them with forums
<FromGitter>
<vladfaust> Slack is free and accessible and not too difficult to use, Discourse is free and accessible and not too difficult to use -- compared to mailing lists and from *my* perspective
<livcd>
that's just silly.
<oprypin>
vladfaust, it's not about what's better, and definitely not about you
<FromGitter>
<f1refly_gitlab> Slack is a "service" that the team can't control by themselfes though
<RX14>
But refusing to use them because they're not perfect is silly
<FromGitter>
<vladfaust> Refusing to use them because you're just got used to something is silly
<FromGitter>
<proyb6> Swift Evolution was on mailing list for sometime before migrating to Discourse
<oprypin>
vladfaust, yes, so don't be silly
<RX14>
Who's refusing to use what? Apart from you
<FromGitter>
<vladfaust> Huh, that was tricky
<FromGitter>
<vladfaust> You got me here, me refusing to use mailing lists just because I don't like it is silly. It's also silly to loose many newcomers just because mailing lists is primary point of communication (before forum is released)
<FromGitter>
<vladfaust> Because if there is me not liking mailing list, there are at least someone else. And from my expereince, among modern devs, there are many
<RX14>
Well the forums are coming so what's the point in continuing this discussion?
<FromGitter>
<f1refly_gitlab> It's also silly to lose many newcomers because you use some esotheric new platform with its own client software, eula and implications
<RX14>
Do you have a time machine on hand?
<FromGitter>
<f1refly_gitlab> at least this thing has got irc
<FromGitter>
<vladfaust> > Well the forums are coming so what's the point in continuing this discussion? ⏎ ⏎ I just want to prove my arguments
<FromGitter>
<sdzyba> Moving to newer tools to attract newcomers is a common practice among open source projects. Remember all those switches from SVN-based engines to GitLab and similar cases
<FromGitter>
<Sija> @vladfaust your arguments are flawed, no need to prove 'em
<FromGitter>
<vladfaust> @Sija that's a thing I'm going to ignore, cause it's simply a trolling
<FromGitter>
<vladfaust> > Moving to newer tools to attract newcomers is a common practice among open source projects ⏎ ⏎ Right
<livcd>
besides Crystal is growing faster than Nim despite having fragmented communication channels and less financial investments or nice looking website/forum
<FromGitter>
<vladfaust> Nim is a bad thing to compare with. We don't compete with Nim
<livcd>
so what do you compete with ?
<FromGitter>
<proyb6> Exilir?
<RX14>
Do we need a single competitor?
<FromGitter>
<vladfaust> > so what do you compete with ? ⏎ ⏎ Nothing, I guess, because Crystal is overweighting literally any other language. We just need to present the language in a right way.
<FromGitter>
<ilanusse> Why don't we compete with Nim?
<FromGitter>
<vladfaust> Because Python devs will never look at Crystal
<FromGitter>
<ilanusse> Fair point
<RX14>
Crystal isn't better than every other language
<FromGitter>
<vladfaust> From my point and experience, it is
<RX14>
And if you think that you will never advertise the language well
<livcd>
Crystal attracts people that seeked better Ruby/Go/D like language.
<FromGitter>
<vladfaust> Crystal is objectively the best
<FromGitter>
<vladfaust> When it's released, of course
<RX14>
Look, I love crystal but there's far more reasons than inertia why it's not popular
<FromGitter>
<proyb6> Compilation time is one of the concern
<FromGitter>
<f1refly_gitlab> (design of the website not being one of those reasons)
<livcd>
yeah
<FromGitter>
<TeddyDD> Crystal's website is best PL website I ever saw.
<FromGitter>
<vladfaust> For me, these reasons will go away on 1.0
<RX14>
Why do you think 1.0 is taking so long then
<FromGitter>
<f1refly_gitlab> The docs that link directly to the compiler sourcecode are the reason i stuck to crystal personally i think
<livcd>
I dont use Crystal because it does not work on Windows. I would probably stop using Crystal if the compile times would be unbearable.
<RX14>
Vlad, I appreciate your opinion but there are many other people in this world with other opinions
<RX14>
And yours is not objective, or better than their opinions
<FromGitter>
<vladfaust> Most of these people do not share their opinions. Expressing one isn't a crime
<RX14>
This is why things need discussion, and why things don't sleazy go your way
<FromGitter>
<f1refly_gitlab> livcd: why do you care about the compile when you don't even use the language?
<RX14>
Always*
<livcd>
which reminds me... :D
<RX14>
Damn autocorrect...
<FromGitter>
<vladfaust> Most of these people do not share their opinions. Expressing one isn't a crime.
<FromGitter>
<vladfaust> They're just sitting silently hoping for the best
<oprypin>
vladfaust, the problem is that you take your opinions as something more than just opinions
<FromGitter>
<vladfaust> It's an illusion, @oprypin, because I'm among the few who actually express their opinions
<oprypin>
and then you act upon just your opinions
<FromGitter>
<j8r> @f1refly_gitlab , livcd LoL: no use of the lang, no compilation, no compile time time problem :)
<FromGitter>
<vladfaust> > and then you act upon just your opinions ⏎ ⏎ Yes, because ofthen my opinion is the one cleary stated
<RX14>
"I'm among the few who actually express their opinions", no you're just one of the few who express their opinions too loudly
<FromGitter>
<vladfaust> ~~too~~ lodly
<oprypin>
KKK's opinion is also clearly stated
<FromGitter>
<vladfaust> WTF, @oprypin
<FromGitter>
<vladfaust> So I'm a Hitler now because of proposing of better taking care of the language's presence?
<FromGitter>
<alehander42> @vladfaust mate, languages are not democracies
<RX14>
Yeah its time to stop now
<FromGitter>
<sdzyba> Is global type inference the main reason for slow compilation times? Let's get rid of it and leave inference in block/method scope :3
<FromGitter>
<vladfaust> I have to go, thanks for great convesation
<FromGitter>
<Sija> o-ho, Hitler argument
<FromGitter>
<forkev_twitter> Ruby like syntax with blazing performance?! give me crystal. Mailing lists? Give me a carrier pigeon - I don't care. whatever the community wants, I'm flexible. Crystal rocks the way it is (compile times and all) and it's only getting better. Waiting for a consensus (aka group think) on anything can kill great teams. I'm happy how we got here, and where we're going. Thank you, RX14. +1 for a new
<FromGitter>
... topic.
<FromGitter>
<Sija> that's how you end up discussions
<oprypin>
sdzyba, i think that the inference may not even be global anymore
<FromGitter>
<vladfaust> o-ho KKK argument
<RX14>
@sdzyba it is, but its too early to give up
<FromGitter>
<vladfaust> that's how you end up discussions
<FromGitter>
<Sija> @vladfaust grow up
<RX14>
When crystal dies it'll be time to give up on global type inference
<FromGitter>
<vladfaust> Yeah, I'm now going to the gym to beat ya ass :D
<FromGitter>
<kinxer> Would people please stop firing off one-liners? The discussion has long-since ceased to be useful.
<oprypin>
alehander42, because they come from Ruby? and it's just nice in general?
<livcd>
j*r:f1refly_gitlab: I did try Crystal but did not pursue my project in Crystal further because of no Windows support.
<FromGitter>
<alehander42> in my toy langs, I almost always stay away from it, and not only because of impl, but because it seems as an unwanted feature to m
<RX14>
@alehander42 because it makes compiled languages as easy to write as dynamic one
<FromGitter>
<ilanusse> Is global inference like not having to directly require files?
<FromGitter>
<alehander42> @oprypin @RX14 haskell programs with no annotations look way worse than haskell programs with annotations
<FromGitter>
<sdzyba> @RX14 I consider global inference a flaw rather than a feature, just to mention. Hurts readability a lot until we have IDE to suggest types on the fly
<oprypin>
ilanusse, no, but they're correlated
<FromGitter>
<ilanusse> Where can I read up on it?
<FromGitter>
<alehander42> all good ruby/crystal programs document their intent and args anyway, a type signature is a 0.01 effort compared to helping one read/analyze the code
<oprypin>
sdzyba, the problem is that even if you added type annotations everywhere you still wouldn't be able to remove this inference
<FromGitter>
<f1refly_gitlab> livcd: well you have that frankenstein bash thing going on, thats what i use when i have to use windows. works okay with crystal imo
<RX14>
@Sija please don't insult people like that
<RX14>
@alehandler42 Haskell has a well specified performant type inference algorithm, and crystal has type annotations
<RX14>
Crystal can't use Haskell's type inference because it doesnt handle unions or subtyping
<livcd>
f1refly_gitlab: I wish people would stop saying WSL is a solution. It is not and will never be.Not because it does not work but because it is not something you do on a VMs or production hosts that are not dev machines. My deployment target is Windows not dev laptop.
<FromGitter>
<alehander42> RX14: what I mean is: I think functions without type annotations in static languages suck
<oprypin>
the way that things work now, the type annotations in many cases are just checks, not direct definitions. i.e. the type that you're passing to the method will still just be that thing, not be converted to the annotated type
<RX14>
Ok, go use go or Java lol
<FromGitter>
<alehander42> because you still have the types, but they are invisible to you, and now you need a good IDEA and hovering etc
<oprypin>
alehander42, i can agree to that but it still wouldn't magically fix compilcation times
<FromGitter>
<alehander42> that doesn't mean local inference isn't desirable: but it's on 3-4 lines in good code, and the types are obvious there
<RX14>
The first thing to solve is to make type annotations actually help compile times
<RX14>
Once that technical issue is solved
<RX14>
Then the semantics of style can bd
<FromGitter>
<alehander42> oprypin: that makes sense, I was talking from a language design point, not really only about crystal impl
<FromGitter>
<alehander42> RX14: there are many great typed languages that are not go/java, don't strawman me :D
<FromGitter>
<Sija> @RX14 u r right
<RX14>
I don't find it hard to find types in crystal programs by eye
<RX14>
Arguments which are ambiguous are usually annotated
<FromGitter>
<alehander42> even in bigger unknown codebases?
<RX14>
The core of ruby is to trust the developer
<FromGitter>
<alehander42> you're right, ruby 3 plans on some inference, but no annotations, e.g. python goes in the other way with mypy
<FromGitter>
<alehander42> different philosophies after all
<FromGitter>
<veelenga> > @veelenga works on integrating Ameba with Codacy IIRC ⏎ @proyb6 @vladfaust i do, thanks.
<FromGitter>
<alehander42> this is why I am a bit sad we cant do large scale scientific measurements of different langdev theories
<FromGitter>
<f1refly_gitlab> livcd: Afaik crystal is a backend language currently. do you run your servers on windows unironically?
<FromGitter>
<proyb6> @veelenga Great! Looking forward to see if more shards could adopt it
<livcd>
alehander42: afaik sorbet.rb by stripe for ruby
<livcd>
f1refly_gitlab: general purpose language and yes I do.
<FromGitter>
<alehander42> livcd: interesting, but afaik it's 3rd party
<FromGitter>
<alehander42> matz said he doesn't plan to add official support for annotations
<livcd>
yes he thinks type inference is the future
<FromGitter>
<alehander42> is sorbet structural ?
<FromGitter>
<proyb6> @alehander42 I'm unsure what is their workflow and how frequently they need to test the code, my thought if we could bring that compilation time down, it's easier for business to adopt since they want the team to be productive and save time.
<FromGitter>
<alehander42> @proyb6 wrong mention?
<livcd>
alehander42: i dont know it's not oss yet afaik.
<FromGitter>
<j8r> I we can pre-compile shards and then linking them to our app, this would save time too
<FromGitter>
<j8r> like in C++
<FromGitter>
<ilanusse> @veelenga So should I try Codacy? Rn my shard just runs Ameba on Travis
<FromGitter>
<proyb6> @alehander42 I was thinking about your " large scale scientific measurements of different langdev theories"
jemc has joined #crystal-lang
<FromGitter>
<alehander42> ahh, well, speeding up compilation is always very good, I agree
<FromGitter>
<alehander42> i was wondering about global inference vs no global inference for productivity tho
<oprypin>
mostly inconsequential probably
<FromGitter>
<proyb6> 2019 is approaching, I think it's a good time to discuss in mailing list, Github, etc because it going to take some time to settle
<FromGitter>
<proyb6> ...on the compilation time issue
<oprypin>
or you can just look at it occasionally without receiving mails
<FromGitter>
<ilanusse> Great thanks
<FromGitter>
<asterite> it's not global type inference, it's just that methods are typed based on call site
<FromGitter>
<asterite> that's all crystal does
<oprypin>
yes but the call site's types are also typed based on methods and the rabbit hole goes pretty deep
<RX14>
You can argue whether or not its technically type inference, but its an algorithm, it starts with types of only literals, and it ends with every variable used typed
<RX14>
And so what you call it is fairly pointless
<FromGitter>
<asterite> I think of global type inference as seeing the whole program and giving each expression a type. But in crystal the code is cloned based on each invocation.
<FromGitter>
<asterite> I wonder how far we could go if all methods were explicitly typed (I probably said this like a million times now :-P)
<FromGitter>
<alehander42> right, language design is an ocean of tradeoffs
<FromGitter>
<ilanusse> Software is general tbh haha
<oprypin>
if, for each compilation unit, you know every method instantiation that it has, what prevents you from caching that unit until there's an unknown instatiation?
blassin has quit [Ping timeout: 250 seconds]
blassin has joined #crystal-lang
<FromGitter>
<j8r> only perform incremental compilation for fully typed interfaces
<FromGitter>
<ilanusse> @proyb6 I added Codacy but it got stuck cloning the repo 👍
<FromGitter>
<proyb6> @ilanusse Great, perhaps Codacy could help on that
<FromGitter>
<asterite> oprypin a method could change without code change if the methods it calls change. For example if their return type change but they are still compatible. So you have to track all the dependencies, and it's a mess. It gets worse with macros
akaiiro has joined #crystal-lang
Renich_ has joined #crystal-lang
Renich has quit [Ping timeout: 240 seconds]
Renich_ is now known as Renich
<FromGitter>
<veelenga> @ilanusse no, the integration is not complete yet. I will do some announcement once it is ready
<FromGitter>
<ilanusse> Oh ok, great
<FromGitter>
<ilanusse> Thanks
<FromGitter>
<greenbigfrog> Anyone ever written a shard to collect metrics? Eg to calculate/measure the average response time in kemal, and alert me when a call took exceptionally longer then the average
<FromGitter>
<ilanusse> Is there interest in a FactoryBot port? I think I might go for that next
lunarkitty7 has quit [Ping timeout: 268 seconds]
lunarkitty7 has joined #crystal-lang
ua has quit [Ping timeout: 246 seconds]
<FromGitter>
<epergo> > I wonder how far we could go if all methods were explicitly typed (I probably said this like a million times now :-P) ⏎ ⏎ you have my sword
ua has joined #crystal-lang
<FromGitter>
<DanilaFe> Doesn't explicitly typing all methods go against the crystal rationale?
<FromGitter>
<DanilaFe> From the readme:
<FromGitter>
<DanilaFe> > Statically type-checked but without having to specify the type of variables or method arguments.
<z64>
yes that's a common sentiment. it's indeed a core design of crystal, but as a consequence (at least in its current implementation) comes at compiler performance costs. compile times and memory usage, and in some cases features like incr compilation, are important to some people. Sometimes to those people improving those things would be worth removing or further limiting features that give crystal its
<jokke>
z64: adding type annotations doesn't speed up the compiler
<jokke>
common misconception
<jokke>
on the contrary: it actually slows it down
<z64>
didn't say that it did, i was just trying to give them more context as to why it was being discussed
<FromGitter>
<DanilaFe> It slows down the compiler because code is still copied for every call site. Presumably it won't be as bad when all methods are explicitly typed
<z64>
right. as mentioned earlier, in the current impl annotations don't do anything to optimize, but they could be made to do so (somehow)
non-aristotelian has joined #crystal-lang
<FromGitter>
<DanilaFe> Right. But doesn't the C++ compiler do monomorphization to? And the auto types feel a lot like crystal's type inference in theory. What's crystal doing differently?
<z64>
rust as well. but i don't know the dirty details of the other langs, only what is laid out in that issue i linked :) maybe someone else can explain.
DTZUZO has quit [Ping timeout: 246 seconds]
<oprypin>
DanilaFe, auto types are very local. and the difference in crystal is that ... you could imagine every method to be a template< ... > with every single parameter in those brackets
<oprypin>
and last i heard, c++ hasnt solved any of these problems when it comes to `template`, it's just that their use is limited enough for it to not be a big problem
<FromGitter>
<DanilaFe> Ah, so the difference isn't in the mechanism, it's in that no one uses the mechanism to the extent that Crystal does
<FromGitter>
<DanilaFe> That makes sense. C++ does have awful compile times when templates come around
<FromGitter>
<DanilaFe> Thanks @oprypin
<FromGitter>
<DanilaFe> Thanks @z64 as well for your explanation
<z64>
no problem :) <3
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<Blacksmoke16> seems like it works fine even if you dont?
<Jenz>
eh, yeah, weird
<Jenz>
Im probably doing something else wrong then, thanks @Blacksmoke16! Now I know I must search elsewhere
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<girng> how many times does a NamedTuple need to be created to trigger a stackoverflow?
<Jenz>
Depends on the namedtuple's members I think
<Jenz>
And the machine, and configuration
<FromGitter>
<girng> basically it grabs data from the db, some code: https://paste.ee/p/cgEHR `player_stats` is my namedtuple, i should be fine? i mean it works good so far, but what if a lot of players are entering the lobby at the same time
<FromGitter>
<girng> could it trigger a stack overflow then, that i can't test...
<FromGitter>
<girng> well, i could put it in a loop i guess
<FromGitter>
<greenbigfrog> How else were you planing on having it?
<FromGitter>
<girng> was thinking of using a hash, but that's heap allocated and heard stack allocation stuff is faster
<jokke>
can i somehow detect if i'm at EOF before a skip?
<FromGitter>
<greenbigfrog> `i could put it in a loop i guess` ⏎ I was "questioning" this
<FromGitter>
<girng> well right now that code i posted above is just used when players log in and enter the lobby
<FromGitter>
<girng> but, if there is a lot of players that log on, that's a lot of stack allocation stuff happening, so it could crash? i don't know how to test it, so i was thinking of putting it in a loop. then see when a stack overflow error occurs possibly?
<FromGitter>
<greenbigfrog> Not quite sure about the math, but I think you'd need quite a lot of users to join
<FromGitter>
<r00ster91> jokke: maybe rescue the IO::EOFError raised by `skip` when the EOF is reached?
<jokke>
i just use read directly
<jokke>
works
<jokke>
i can check the count
<FromGitter>
<asterite> jokke: I used this regex: /#(\d+) @ (\d+),(\d+): (\d+)x(\d+)/
<FromGitter>
<asterite> you don't need to escape '#', ',', ':'
<FromGitter>
<kinxer> @Jenz I have no idea. I figured that @greenbigfrog had a reason to do that.
<Jenz>
Oh, he was the one I should've tagged I suppose
* Jenz
:)
<FromGitter>
<kinxer> Yup. The time savings in your example are dramatically convincing, though. It's like 100 times faster, I think.
<Jenz>
~175.6184210526316 times faster than @greenbigfrog's initial example
<FromGitter>
<asterite> Jenz: haha, thanks 😅 . But why?
<Jenz>
I just saw it and decided to award some praise
<FromGitter>
<asterite> :-D
<Jenz>
Also somewhat ashamed of my clunky method
<FromGitter>
<asterite> My method is actually brute force. Same for part 2
<FromGitter>
<asterite> It still runs incredibly fast for some reason...
<FromGitter>
<greenbigfrog> Got a link handy?
<FromGitter>
<asterite> for those solutions?
<FromGitter>
<greenbigfrog> yeah
<FromGitter>
<greenbigfrog> jenz: your code is of course better, but I was just trying to show my issue 😄 Your code is faster, but not applicable to my actual use 😏
<FromGitter>
<girng> can someone please help with my stack overflow question. when will a stack overflow happen using a namedtuples (from retrieving several string fields from a row in the db). and if a stack overflow can happen, would it be more beneficial to use a heap allocation (hash) instead?
<Jenz>
Oh, nice @kinxer
<Jenz>
with that example you can drop the initial capacity I'd say, which should make it somewhat faster
<Jenz>
Dunno about the actual case though
<FromGitter>
<kinxer> Unfortunately, it doesn't work if you need to use `#has_key?`, though.
<FromGitter>
<asterite> @girng i don't think a stack overflow will happen because of a named tuple
<FromGitter>
<greenbigfrog> @asterite rly gotta say your solution for d3p2 is amazing 😄 especially compared to mine
<FromGitter>
<kinxer> @jokke I don't see anything. I guess you could do https://carc.in/#/r/5oq2
<Jenz>
Bad idea to include rand, will add a random factor to the time
<FromGitter>
<kinxer> @jenz Oh, I meant my own implementation when I said that.
<Jenz>
?
<Jenz>
Oh like that, ok :)
<FromGitter>
<kinxer> Yup. Your carc.in link was exactly what I meant. :)
<FromGitter>
<girng> @j8r github just emailed me back about that user ammarfaizi2. it was automated so i sent them another email
<FromGitter>
<girng> @asterite ty for confirm. i should be fine then. i'll stop worrying about it now =]
<RX14>
dont worry about stack overflows until they happen :)
<FromGitter>
<bararchy> @girng how goes your game? :)
<jokke>
interesting
<jokke>
crystal's range behaves differently than ruby's
<jokke>
-5..1 will actually be iterable
<jokke>
sorry
<jokke>
i meant 1..-5
<jokke>
in ruby it won't iterate over ranges where end < begin
<FromGitter>
<girng> @bararchy good. i got a 512mb ram vps for $2.50/yr on black friday, so testing my gameloop on that, very fun
<FromGitter>
<bararchy> still waiting for beta access ;)
<FromGitter>
<girng> i'll pm you when we launch :D
<jokke>
can i use {{original_def}} to insert the original def of a method i'm monkey-patching?
<Jenz>
@girng there are many eager about this game of yours here
<FromGitter>
<girng> powered by crystal on the server!!!
<FromGitter>
<girng> disgonnabegood.jpg
<FromGitter>
<kinxer> So, what is this game?
<FromGitter>
<ilanusse> I'm gonna start coding something akin to Devise
<FromGitter>
<ilanusse> Does anyone know if both Lucky and Amber conform to some kind of Rack interface?
<FromGitter>
<ilanusse> Or will I have to choose one?
Jenz has quit [Quit: night]
<RX14>
@ilanusse there's "rack" already in the stdlib
Yxhuvud has quit [Ping timeout: 268 seconds]
<RX14>
you should use HTTP::Server::Handler
<FromGitter>
<ilanusse> I'll look into that, thanks!
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter>
<girng> @kinxer top down arpg inspired by diablo 2. item sockets, orbs to craft/re-roll your weapon, intrusion system, skill tree, all weapons can be used by both classes (only have 2 classes right now). can buy microtransaction for weapon effects, custom head texture, and more. it will be instanced based ofc similar to diablo 2's lobby create/join game system
<FromGitter>
<greenbigfrog> and the server part will be crystal? Open Source?
<FromGitter>
<girng> cool skill gems too. got 9 or so working right now, arc (with chain (xx mobs nearby)), stampede, ice rain, cosmic nova, magic arrow, whirlwind, etc. all intertwined that use crystal on the backend to help. especially when a monster takes damage, i do some cool tricks with crystal and godot so the server doesn't die when a player who has 500% attack speed doesn't nuke the instance
<FromGitter>
<greenbigfrog> cool
<FromGitter>
<greenbigfrog> you doing this as a hobby project?
<FromGitter>
<girng> yep. i code as a coping mechanism. helps a lot
<FromGitter>
<girng> ty for your interest, btw <3
<FromGitter>
<vectorselector> Is it true that JSON.mapping is going away?
<FromGitter>
<j8r> @vectorselector nothing is decided. Don't worry, if it goes, it will be on a shard
<oprypin>
vectorselector, and just in case you didnt know, there is a very similar replacement JSON::Serializable
<FromGitter>
<j8r> IMO all this serialization stuff should go on shards... Like Rust, Go, Java...
<FromGitter>
<vectorselector> OK, understood, thank you. Agreed, as maybe it'll be 99% message-pack in 2021 or whatever...fashions change. not in core.
<FromGitter>
<elorest> @ilanusse ⏎ ⏎ > I'm gonna start coding something akin to Devise ⏎ Does anyone know if both Lucky and Amber conform to some kind of Rack interface? ⏎ Or will I have to choose one? ... [https://gitter.im/crystal-lang/crystal?at=5c05b56dc4af6856da80e7b3]