<ben___>
Channel is only to communicate a typed data to a receiving channel (same channel but another fiber), so a reading fiber can do next thing (like 4 fibers are calculating image manipulation or waiting for DB or HDD and so on), but a request should be a request on this one fiber. Channels do not concrete things like puts... They just send special information, where useful
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 248 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter>
<Blacksmoke16> gotcha
faustinoaq has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
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]
Liothen has quit [Ping timeout: 260 seconds]
Liothen has joined #crystal-lang
snsei has joined #crystal-lang
sherjilozair has joined #crystal-lang
Guest9089 is now known as Cyrus
snsei has quit [Ping timeout: 268 seconds]
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
snsei has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
snsei has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
tankf33der has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
sherjilozair has quit [Remote host closed the connection]
sherjilozair has joined #crystal-lang
sherjilozair has quit [Remote host closed the connection]
<FromGitter>
<faustinoaq> ^^ Oh, Microsoft own a lot of good names 😅
ua has joined #crystal-lang
ua_ has quit [Ping timeout: 248 seconds]
<FromGitter>
<codenoid> > > puts "hello"
_whitelogger has joined #crystal-lang
<FromGitter>
<bararchy> @faustinoaq They will soon add github to that list
<FromGitter>
<bararchy> :(
<FromGitter>
<bararchy> btw, shards support gitlab ?
<faustinoaq>
Oh :/
<faustinoaq>
@barachy What about canonical?
<faustinoaq>
s/@barachy/ @bararchy / ^^
<FromGitter>
<bararchy> They don't own them they colaborate
<FromGitter>
<bararchy> github is going to be a different story
<FromGitter>
<bararchy> they gonna buy them
<FromGitter>
<bararchy> which means it becomes a full Microsoft platform
<Yxhuvud>
not necessarily.
<Yxhuvud>
but it will probably mean more integration with microsoft products and possibly more focus on enterprise customers.
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter>
<bararchy> It also means I need to trust Microsoft with my private repo code
rohitpaulk has joined #crystal-lang
<FromGitter>
<bararchy> it's a conflict on interest, github only makes github, it's not a software house but a platform. ⏎ Microsoft on the other hand is into software development, and it's going to hold alot of closed source code of other people in it's hands
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<ben___>
Thank them for VS Code
<FromGitter>
<bararchy> VS Code is good, so is sublime and vim and emacs and... ⏎ what's does code editor have to do with github purchuse discussion though?
duane has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<ben___>
Microsoft is going to change cause they know about developers and contributors. However, thats all a little bit of risc
<ben___>
Thanks for sublime?? I paid 50 Euro for my first license
<FromGitter>
<bararchy> Oh, I didn't pay, using sublime2
<ben___>
Ok, I want to pay for this, but, in this discuss - not
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
Groogy has quit [Quit: WeeChat 2.1]
snsei has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
<ben___>
@Blacksmoke16 can't interpret gotcha ? ;-) are you going better with channels?
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
pabs has quit [Ping timeout: 256 seconds]
pabs has joined #crystal-lang
TCZ has joined #crystal-lang
tzekid has joined #crystal-lang
tzekid has left #crystal-lang [#crystal-lang]
rohitpaulk has quit [Ping timeout: 256 seconds]
bazaar has quit [Ping timeout: 256 seconds]
bazaar has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
alex`` has joined #crystal-lang
pabs has quit [Ping timeout: 265 seconds]
pabs has joined #crystal-lang
TCZ has quit [Quit: Leaving]
TCZ has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<CaDs> Back from the RubyKaigi. It was interesting that a lot of teams and people are currently working on different ways to "compile" ruby and to enable (to some extend) type checking. ⏎ ⏎ And while I was listening to their progress and their difficulties achieving this I could not avoid thinking (and asking to some committers) about the way Crystal handles all those things in an efficient and elegant way. ⏎ ⏎
<FromGitter>
... Of course the compiler could be faster, and still there are lots of things Crystal needs to "get right", but for being such a young language I think is in a very nice position. ... [https://gitter.im/crystal-lang/crystal?at=5b13d743160c567d16fc9df7]
<FromGitter>
<bararchy> 🎉
<FromGitter>
<fgimian> +1
<FromGitter>
<bararchy> same feeling when I see truffle-ruby all over
Raimondi has joined #crystal-lang
<FromGitter>
<CaDs> trufle-ruby is gonna be big
<FromGitter>
<CaDs> the demo was amazing
<FromGitter>
<CaDs> the only thing I'm not so sure about is Oracle's licensing strategy
<FromGitter>
<CaDs> anyway, it was great
<FromGitter>
<fidellr> hi, i'm coming from go and i want to try how fast performance and great dev experience that crystal has, could anyone point me where should i start to learn from ? thx
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<fgimian> @fidellr I found the docs extremely handy, there's a really nice tutorial on the website.
<FromGitter>
<fgimian> It covers most areas of the language with nice examples and easy to read information.
<FromGitter>
<bararchy> @fidellr Good luck on your journy :)
<FromGitter>
<fidellr> yes i read that already but not all of it, i can't see any tour/tutorial like go, can you point me with a specific link ? @fgimian , thanks a lot btw @fgimian @bararchy 😃
<FromGitter>
<fgimian> and then just hit the arrow keys on your keyboard to go through the sections
<FromGitter>
<fgimian> To be honest, one of the things I LOVE about Crystal is that almost the entire source code is written in Crystal
<FromGitter>
<fgimian> so one of the best things I did while learning was clone the Crystal GitHub repository and use that as a good learning reference
<FromGitter>
<fgimian> I do see your point yeah. I'm personally not aware of anything that's exactly like that Go tutorial in Crystal land. The pages I mentioned introduce you to all language features one at a time.
<FromGitter>
<fgimian> You did hit the > arrow and go through the other pages right?
<FromGitter>
<fgimian> there's a lot in there
<FromGitter>
<fidellr> yeah i can see that, but some of the syntax is not explained for example the usage of `::`
<FromGitter>
<fidellr> or double colons
<FromGitter>
<fidellr> yes
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<fgimian> I see your point, I'm not aware of anything more extensive than the docs I linked; but many things that Crystal does are similar to Ruby.
<FromGitter>
<fidellr> btw i'm not from ruby land, so sorry for the stupid questions because it 's unfamiliar for me
<FromGitter>
<fgimian> nah not at all, I should tell you that I'm new to the language myself and also not a Ruby guy
<FromGitter>
<fgimian> but I did find Ruby docs and answers very helpful while I was learning Crystal
<FromGitter>
<fgimian> perhaps the more experienced guys here can point you in a better direction
<FromGitter>
<fgimian> what language are you coming from?
<FromGitter>
<fidellr> i see, well i came from c++, js, go and a bit rust, but i do a lot in go, js and c++, so the ruby syntax seems odd to me lol, how bout you btw?
<FromGitter>
<fidellr> i just shocked when i saw the benchmarks of crystal, so i came here 😄
<FromGitter>
<fgimian> yeah, it's pretty crazy
<FromGitter>
<fgimian> I'm coming from Python but also started in C++
<FromGitter>
<fgimian> the import system in Ruby / Crystal reminds me of C++
<FromGitter>
<fgimian> modules are like namespaces
<FromGitter>
<fgimian> require is like #include
<FromGitter>
<fgimian> :)
<FromGitter>
<fgimian> I'm afraid I have to get to bed
<FromGitter>
<fgimian> all the best and have fun
That_Guy_Anon has joined #crystal-lang
<FromGitter>
<bararchy> @fidellr I would suggest trying to create a small project, like calculator etc.. And then look at what you want to do at each step and find in the docs.
<FromGitter>
<bararchy> Apart from that, searching for 'calculator in ruby' will probably give you a working crystal example
<FromGitter>
<fidellr> ahh i can see that, thanks a lot btw @fgimian , right i have to try it and read the docs for solving the solutions, thanks @bararchy
<FromGitter>
<Grabli66> Release? :)
TCZ has quit [Quit: Leaving]
<FromGitter>
<bararchy> @Grabli66 still waiting haha
<FromGitter>
<fidellr> the first salute is printing noway instead of fidel, it should print fidel because i changed it after i puts/print it, why is this happened?
<FromGitter>
<fidellr> btw it should print `Hello #{name}` but it only print the @name prefixed only
<FromGitter>
<bararchy> Ok, so, the first "why it prints `noway` is because of IO race condition. ⏎ you can do ⏎ ⏎ ```def salute() ⏎ puts "Hello #{@name}" ⏎ STDOUT.flush ⏎ @name = "noway" ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5b13fb83f9f2e56cf238e50e]
<FromGitter>
<fidellr> why should i flush it ? :/
<FromGitter>
<fidellr> instead of just redefined with another value
<FromGitter>
<fidellr> btw it still logged the same result
<FromGitter>
<bararchy> I'll tell you why, the `@` means an instance var, this means that it changes all over your class. ⏎ ⏎ if you would do for example ⏎ ⏎ ```name = @name ⏎ puts "Hello #{name}"``` ... [https://gitter.im/crystal-lang/crystal?at=5b13fbfd352b9e1a4b559f67]
<FromGitter>
<bararchy> I think you might be confused because of the crystal play output, please do `puts g.salute` etc..
<FromGitter>
<bararchy> also, seems the STDOUT is not needed, I confused you too, sorry
<FromGitter>
<bararchy> try saving the code into a file, and just run it with ⏎ `crystal greeter.cr`
<FromGitter>
<fidellr> ahh yes the right square is showing the types only but not the output, sorry for confusing you , thanks!
<FromGitter>
<bararchy> np, happy to help
<FromGitter>
<fidellr> i should look into the output panel of crystal help,
<FromGitter>
<bararchy> the right one shows the `return type` which is the `"noway" : String`
<FromGitter>
<fidellr> yes, sorry for the mistakes
<FromGitter>
<bararchy> as it's the last thing in the salute method
TCZ has joined #crystal-lang
<FromGitter>
<fidellr> got it
<FromGitter>
<bararchy> no no it's all good. ⏎ Some people are not used to it, in Ruby and Crystal each method (def...) returns the last type that was used, even when not using explicit return
<FromGitter>
<bararchy> but it's really just languge idioms
<FromGitter>
<bararchy> both will work ofc
<FromGitter>
<fidellr> ahh i see, btw is crystal has function could return multiple values feature? just asking..
<FromGitter>
<bararchy> btw, in Crystal you can `force` the return type to be something specific by using ⏎ ⏎ ```def equal?(a,b) : Bool ⏎ a == b ⏎ end``` ⏎ ⏎ This will tell the compiler to expect and verify that this method returns a Bool, else it will thorw a compile time error [https://gitter.im/crystal-lang/crystal?at=5b13ff2a22a05f5e71f91b4e]
<FromGitter>
<fidellr> wow same like go
<FromGitter>
<bararchy> @fidellr What do you mean? like multiple values as in array ? or multiple types ?
<FromGitter>
<fidellr> so i could set conditional stmt for any error outside that function
<FromGitter>
<bararchy> Not that I know of, but let's see if I maybe missing something :) ⏎ But you can do something similar with array ⏎ https://play.crystal-lang.org/#/r/47dz
<FromGitter>
<bararchy> just need to explicit call return
<FromGitter>
<fidellr> seems like i keep dig into it for the long run
<FromGitter>
<fidellr> i see
<FromGitter>
<bararchy> :)
<FromGitter>
<fidellr> got it, thanks man!
<FromGitter>
<bararchy> np, enjoy
<FromGitter>
<fidellr> 👍
pabs has joined #crystal-lang
rohitpaulk has joined #crystal-lang
Nathanaelle has joined #crystal-lang
<FromGitter>
<fidellr> btw what are your preferred editor for crystal? i use vscode but i can't see the definition of the code when i hovered it like other language does, even i used the extendsion, cmiiw
TCZ has quit [Quit: Leaving]
<FromGitter>
<bararchy> @fidellr I use vscode too, to get better support install crystal extension and use `scry` , it adds lots of great things + support for hover etc..
<FromGitter>
<bararchy> @faustinoaq can help out with it
<FromGitter>
<bararchy> Oh, this is our biggest pitfall, the db driver is not really optimized, its being worked on.
<FromGitter>
<bararchy> @fidellr keep in mind that Rust is all a non-GC language, which means it will always be faster, at least in theory
<FromGitter>
<bararchy> But ofc it means memory management on dev side
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
<FromGitter>
<fidellr> yes it make sense that rust more faster because of non-GC, but it still beaten by go with actix framework
<FromGitter>
<fidellr> i still try to do a research for this case
<FromGitter>
<bew> @bararchy note: it's better to use a tuple when returning multiple values from methods
<FromGitter>
<bararchy> @bew yeha it makes more sense, I don't know why it didn't work for me without explicitly writing return
<FromGitter>
<fidellr> i saw the right square on crystal-play it automatically return a tuple when we return two values, is really automated like that?
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter>
<r00ster91> how can I execute the function/the actions that get normally executed when I press CTRL+C? Or can I be 100% sure that it will be just `exit` on all operating systems?
dragonkh has joined #crystal-lang
<dragonkh>
hi - is there a Crystal version of PBKDF2 available?
<FromGitter>
<r00ster91> @bararchy yes im getting key input with STDIN.raw and then CTRL+C doesnt gets automatically invoked. But I think I will just invoke `exit` then
<FromGitter>
<bew> @Blacksmoke16 I don't understand what you mean by "there a way to have it not union the types since they are mutually exclusive?"
<oprypin>
<@Blacksmoke16> say i have JSON::Any data type and im passing it to a function
<oprypin>
you've already made a mistake there
That_Guy_Anon has joined #crystal-lang
<oprypin>
you're supposed to get rid of JSON::Any as soon as possible, or even avoid it altogether
<FromGitter>
<Blacksmoke16> thats why its being passed to the function, to resolve it into an object
<oprypin>
i guess that makes sense
<FromGitter>
<bew> @Blacksmoke16 checkout my example, there's no JSON::Any involved
<FromGitter>
<Blacksmoke16> ideally i could use JSON.mapping but in this case i cannot :/
wrq has quit [Quit: Connection closed for inactivity]
Nathanaelle has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> kinda hard to explain, but is mainly due to there being another function that maps the input values to their correct types and sets them, based on a diff mapping syntax
<FromGitter>
<Blacksmoke16> i tried using it, but it would require a good amount of work to get everything to work with both imo
<oprypin>
could be still doable with mapping
<FromGitter>
<Blacksmoke16> then would have to maintain two mappings of pretty much the same data
<oprypin>
Blacksmoke16, so you're saying " the return value of the function is a union of self | Array(self)" but isn't that exactly what you wrote in your code?
<oprypin>
if you want an array of one item, you can write `[new(args["foo"].as_s)]` not `new(args["foo"].as_s)`
Nathanaelle has joined #crystal-lang
<FromGitter>
<Blacksmoke16> moreso the question was is there a cleaner way to have the function only return 1 type, vs doing .as(Foo) or .as(Array(Foo))
<FromGitter>
<bew> what would be the type?
<FromGitter>
<Blacksmoke16> whatever the class the function gets called on
<oprypin>
Blacksmoke16, either you're missing a really obvious thing or you're forgetting to explain something
<FromGitter>
<Blacksmoke16> can you not specify the return value by calling .as(type) before returning the value?
<FromGitter>
<Blacksmoke16> im thinking no because its still possible for the function to return both types
<oprypin>
Blacksmoke16, dude... your function can return Array(Foo) or Foo. the function's return type is `Array(Foo) | Foo`. where is your surprise coming from?
<oprypin>
before it was array or foo, now you say array.as(Array) or foo.as(Foo) but it's still the same union in the end
<FromGitter>
<Blacksmoke16> right, yea idk why that was so confusing for me
<oprypin>
the runtime type is always precise, of course
<oprypin>
but at compile time there's no way to make the type precise because it depends on the runtime value of the string
<FromGitter>
<schoening> Could I get some help sending binary data over websockets? ⏎ In NodeJS I just send new Float32Array([1,2,3]) but I don't know the equivallent for crystal...
<FromGitter>
<Blacksmoke16> yea that was my confusion i think
wuehlmaus has joined #crystal-lang
<FromGitter>
<bew> @schoening what serialization are you using ? what do you mean exactly by "sending binary data" ?
<FromGitter>
<schoening> I used NodeJS to send Float32Array buffers to the browser instead of JSON. Now I want to do the same with Crystal. Sorry if I can't explain myself correctly.
<oprypin>
schoening, how can you receive those buffers in javascript? from what i've read there is no protocol support
<FromGitter>
<schoening> Well, I am far from as knowledgable as you guys, but I simply do this on the client side: ⏎ const data = new Float32Array( message.data );
<oprypin>
please just show complete examples of: sending float array in js; receiving float array in js
<FromGitter>
<faultyserver> I've solved this in the past by introducing intermediate types in the hierarchy, but that doesn't really work here (because the node types are semantically unrelated, they are just both valid in this case)
<FromGitter>
<faultyserver> I guess the other solution is to use `[] of Call | Const` whenever I want to call the initializer
<FromGitter>
<faultyserver> More generally, if that's *not* a bug, I'd like to understand what purpose the expansion really serves (other than being the Hindley-Milner "most generic type expression" thing)
<FromGitter>
<bew> oh for that... yeah you need to be explicit for now, but this will be as you expect in next release (see: #6024)
<FromGitter>
<faultyserver> cause in every case I've run into, when I write out a type union, I'm pretty explicitly only trying to accept the types I wrote out (and I guess subtypes of those types)