<FromGitter>
<girng> is it just semantics, or is there a performance difference using either 1?
<FromGitter>
<Blacksmoke16> well the diff is in the first one you are passing each named param on its own, while in the 2nd you are passing it a named tuple
<FromGitter>
<Blacksmoke16> but also notice in the first how you are passing it `1` as first param
<FromGitter>
<Blacksmoke16> the splat accounts for additional params after the first required
return0xe has quit [Remote host closed the connection]
return0xe has joined #crystal-lang
jokke__ has joined #crystal-lang
<FromGitter>
<bararchy> I just had the amazing experiance of building an `npm` package, who the hell said that crystal is slow to compile ...
<FromGitter>
<bew> X)
Groogy1 has joined #crystal-lang
<Groogy1>
Morning! o/
ua_ has quit [Quit: Leaving]
ua has joined #crystal-lang
Raimondii has joined #crystal-lang
ashirase has quit [Ping timeout: 244 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
ashirase has joined #crystal-lang
<FromGitter>
<bew> Hey Groogy, how are you doing? ;)
sz0 has joined #crystal-lang
hightower2 has quit [Remote host closed the connection]
<Groogy1>
Just fine, vacation over so back to work. Got tons of stuff done with my crystal projects though
<FromGitter>
<bew> Cool! What did you do?
<Groogy1>
Fixed so my libraries would work better with shards and put together at least an example on boleite on how to get started with the framework
<Groogy1>
also continued on my game
DTZUZO has joined #crystal-lang
<FromGitter>
<icyleaf> Hey folks, Halite v0.7.0 has been released, here is some mainly changelog: ⏎ ⏎ 1) Features (a.k.a middlewares) support ⏎ 2) Add cache feature (speed up developing) ⏎ 3) And some API changes. ... [https://gitter.im/crystal-lang/crystal?at=5b8d0ff21d3a5711b6d9733b]
hightower2 has joined #crystal-lang
<jokke>
hey there o/
<jokke>
is there something like a file watcher lib similar to maybe guard which would allow compiling crystal sources on change and maybe running the compiled program?
<FromGitter>
<rishavs> I am trying to do some simple html parsing using the XML/httpClient libs. How do I get a specific tag from the html? ⏎ In my example, I am trying to retrieve a tag `<meta content=\"My cool website\" name=description />` ⏎ my code is; ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5b8d2e0dcff55e56179e8709]
<FromGitter>
<bew> This is not XPath syntax
<FromGitter>
<bew> Looks like you need to do `//html/head/meta[@name=description]`
<FromGitter>
<bew> Oops with `'` around `description`
<FromGitter>
<bew> So: `//html/head/meta[@name='description']`
<FromGitter>
<bew> (not tested, i applied what wikipedia said^^)
<FromGitter>
<rishavs> I actually had tried this earlier . it gives me nil :( `pp document.xpath_node("//html/head/meta[@name='description']")`
<FromGitter>
<bew> Then it can't find it
<FromGitter>
<bew> ..
<FromGitter>
<rishavs> i have also tried `pp document.xpath_node("meta[@name='description']")` and `pp document.xpath_node("//meta[@name='description']")`. They all just give nil as output 😢
<FromGitter>
<f1refly_gitlab> Have you tried giving the meta element actual content? I haven't worked with xpaths in crystal yet, but i guess it tries to return the contents instead of the node element
<FromGitter>
<bew> Hm no it should return the node here
<FromGitter>
<bew> And in this case, the first node (only) matching this xpath
<FromGitter>
<rishavs> @codenoid my plan is to try with vanilla crystal. Only if there is no other way, i'll use libraries 😄
<FromGitter>
<rishavs> So far i have used 0 libraries in my web project. Its masochistic but fun
<FromGitter>
<f1refly_gitlab> jokke: Probably not. I didn't knew you where doing something as complex, as for small and simple projects guardian is probably the easier solution, hence my recommendation
<FromGitter>
<codenoid> 👍 @rishavs
<FromGitter>
<f1refly_gitlab> @rishavs In your example xml the element "name" has the value "description", but the quotes are missing. Could you try using `<meta content="My cool website" name="description" />` instead in your html?
<FromGitter>
<proyb6> I wonder who been doing benchmark on Crystal?
<jokke>
sure :)
<jokke>
but it's not _that_ complex
<jokke>
i'd argue it's a very common usecase
<jokke>
it's kinda like shotgun for ruby
<FromGitter>
<f1refly_gitlab> It's more complex than "if i change a thing please recompile", which is the only use case of the people i know, since we're not web developers and mostly toying around with the language
<jokke>
ah sure
<FromGitter>
<f1refly_gitlab> But yeah, it probably is common
<FromGitter>
<f1refly_gitlab> I'll give you that
<FromGitter>
<f1refly_gitlab> also guardian is hand
<jokke>
crystal is reeeeally great for the web ;)
<jokke>
and the ecosystem is growing pretty fast
<FromGitter>
<f1refly_gitlab> I think crystal is a good general use language that will be great with multi threading
<jokke>
well it has green threads already
<FromGitter>
<j8r> Fibers you mean
<FromGitter>
<f1refly_gitlab> I think it doesn't has true multi threading yet
<jokke>
yeah no native threads
<FromGitter>
<j8r> There is concurrency, and multi process
<FromGitter>
<f1refly_gitlab> fibers != multithreading, but they're working on it
<jokke>
but it already takes advantage of io blocking
<FromGitter>
<f1refly_gitlab> yeah, its very handy
<jokke>
so it has the same type of multithreading as most scripting languages
<jokke>
which have the global interpreter lock
<jokke>
like ruby or python
<FromGitter>
<f1refly_gitlab> Except it's not a scripting language and is not interpreted
<jokke>
exactly
<FromGitter>
<f1refly_gitlab> Well, it's fast enough for my purposes as is
<jokke>
which results in much lower memory footprint which in turn lets you spawn up as many instances as you have cores if you don't need IPC
<jokke>
so for the web when you're dealing with stateless apis and such it's already great as is
<FromGitter>
<f1refly_gitlab> Hmm
<FromGitter>
<f1refly_gitlab> As a not-web-developer, where can i learn about this?
<jokke>
but it will become truly awesome with real multi processing
Raimondii has joined #crystal-lang
<jokke>
hmm good question
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<j8r> Multi thread is only really useful for games
<jokke>
well and number crunching
<jokke>
or image/video processing
<FromGitter>
<f1refly_gitlab> It's also useful for heavy calculations
<FromGitter>
<f1refly_gitlab> yeah
<FromGitter>
<j8r> But else you may want to scale at number of machines
<FromGitter>
<j8r> not only on a big single one
<FromGitter>
<f1refly_gitlab> The programs i work with need to perform tons of complex calculations very fast to stay somewhat responsive and we're using c++
<jokke>
stuff like travelling salesman and other np complete algorithms can sometimes also profit from multithreading
<FromGitter>
<j8r> It's simpler to spawn N processes for N number of cores, with instances communicating to each others, than designing a multihread app to laverage 16 cores
<jokke>
travelling salesman is actually only np hard though
<jokke>
you could use something like zeromq for ipc
<jokke>
i think there are even bindings for crystal
<jokke>
yup
<FromGitter>
<j8r> for example look at AWS, better to spawn 8 T2 small than 1 big c5 x2large
<jokke>
j8r: AWS lambda can run binaries :P
<FromGitter>
<f1refly_gitlab> It's all purely hypothetical currently because we deploy for windows anyway (i know, i know...)
<FromGitter>
<f1refly_gitlab> We're toying around with it to present it to our boss should it be available in the future
<FromGitter>
<rishavs> @f1refly_gitlab unfortunately, i don't have control on the tags. I just chose that as an example. the exact tag is `<meta content=\"Tate, a young boy on the autism spectrum, loves watching tops spin. One day, he realizes that watching them takes him into a different world.\" name=description />`. My end goal is to strip the open graph tags from the html of any website
<FromGitter>
<j8r> jokke: I don't for lambda if it's better to spawn more single threadfunctions vs one big that do multi thread
<FromGitter>
<f1refly_gitlab> @rishavs Shame. Can you test it anyway so we can see if this is the problem with the previous approach
<jokke>
j8r: yeah that's what i meant. spawning a single threaded crystal binary in lambda
<jokke>
also docker swarm with replication is great to make use of this
<FromGitter>
<j8r> i mean, for example, a go binary?
<jokke>
hm?
<FromGitter>
<j8r> What's the recommended GOMAXPROCS?
<FromGitter>
<j8r> on Lambda
<jokke>
i have no idea
<jokke>
i've only fiddled with lambda once
<jokke>
if i read the docs of lamba correctly it just scales horizaontally
<FromGitter>
<j8r> makes totally sense
<FromGitter>
<j8r> so goodbye the big java monolith
<FromGitter>
<f1refly_gitlab> I can't because i can't be assed to handle the proxy my employer set up for the non-it folks. I downloaded the websites html though, that's what i put in site.html
<FromGitter>
<f1refly_gitlab> don't use double quotes, but single quotes
<FromGitter>
<f1refly_gitlab> That's because the trailing if is actually a macro that the compile expands to a full if later but doesn't like for type checking to my understanding
<FromGitter>
<codenoid> @rishavs is that content loaded by ajax ?
<FromGitter>
<rishavs> @f1refly_gitlab same. nil 😿 ⏎ @codenoid I don't think so. I really hope noone is putting meta tags using ajax as that would break all sorts of spiders
<FromGitter>
<rishavs> i will try another site, which I am certain has no ajax tags
<FromGitter>
<vladfaust> A very important and feature-rich commit, yeah
<FromGitter>
<vladfaust> Just wanted to share that finally after 1.5 years I put something into the core
<FromGitter>
<rishavs> 👯
<FromGitter>
<Blacksmoke16> is there a crystal version of PHP elvis operator like `foo = bar ?: baz;` which resolves to like `foo = bar ? bar : baz;`
<FromGitter>
<bew> @Blacksmoke16 `foo = bar || baz`
<FromGitter>
<bew> @vladfaust yay \o/ welcome to the party ;)
* FromGitter
* Blacksmoke16 facepalm, forgot about that one
<FromGitter>
<Blacksmoke16> thanks
<FromGitter>
<noahlh> Wondering if the following is possible or if I'm taking the wrong approach: Is there a way to assign a splat argument to an instance variable if the arguments themselves are Tuples of unknown size? (I'm implementing a Matrix data structure). For example, I'd like to be able to do: ⏎ ⏎ ```struct Matrix ⏎ def initialize(*input) ⏎ @data = input ⏎ end ⏎ end``` ⏎ ⏎ But without an explicit
<FromGitter>
<noahlh> (I'm still getting the hang of generics so this is slightly new ground for me - very helpful)
salvor has joined #crystal-lang
<FromGitter>
<noahlh> what's the difference between your latter 2? How is Matrix(*T) handled differently from Matrix(T)?
<FromGitter>
<Sija> depends do you want to have the type tuple expanded as a @data type or not
<FromGitter>
<Sija> the first one is of type `Matrix(Tuple(Tuple(Int32, Int32, Int32, Int32), Tuple(Int32, Int32, Int32, Int32)))`, 2nd: `Matrix(Tuple(Int32, Int32, Int32, Int32), Tuple(Int32, Int32, Int32, Int32))`
<FromGitter>
<noahlh> ahhhh i see
<FromGitter>
<noahlh> that makes perfect sense
<FromGitter>
<noahlh> this is extremely helpful - thanks again
<FromGitter>
<Blacksmoke16> i found a strange bug, but im not sure what is causing it...https://paste.ee/p/cJe8M
<FromGitter>
<Blacksmoke16> cant seem to reproduce it outside of mosquito, maybe @robacarp has an idea?
pabs has joined #crystal-lang
hightower2 has quit [Ping timeout: 244 seconds]
<FromGitter>
<Blacksmoke16> huh cant reproduce it at all now
<FromGitter>
<Blacksmoke16> oh well
<FromGitter>
<Blacksmoke16> ah there it goes
<FromGitter>
<robacarp> Weird. Maybe a networking or server glitch?
<FromGitter>
<Blacksmoke16> thinking it has something to do with the my HTTP client keep-alive, being idle for too long
<FromGitter>
<Blacksmoke16> because only seems to happen when the time between each run is higher
zorp has quit [Ping timeout: 252 seconds]
<FromGitter>
<Blacksmoke16> yea must be something with that, ran fine first time, then 2min later ran again and got the error. closed my client connection at end of each run and 2nd time ran fine
<FromGitter>
<Blacksmoke16> will let it run longer and see what happens
zorp has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter>
<bew> I can't find the (iirc open) issue about destructuring, anyone has the link? (for things like `a, b, *rest = {1, 2, 3, 4}`)