<FromGitter>
<Daniel-Worrall> I think shards don't update when tags are made. ⏎ The shard is listed as 0.1.0 on their `shard.yml` but hasn't released any versions, you install it with `shards install`. ⏎ The shard releases new commits, then tags and releases 0.1.0. ⏎ You now specify version: ~> 0.1.0 in your `shard.yml` ⏎ `shards install` won't update the lockfile (maybe this part is intentional) and install from the commit
<FromGitter>
<watzon> It only updates based on releases, otherwise you have to specify a branch or tag manually
<FromGitter>
<Daniel-Worrall> if you don't specify a release, it takes the master and calls it a version
<FromGitter>
<Daniel-Worrall> so if you "update" from that to the released version, it doesn't actually update
<FromGitter>
<Blacksmoke16> if you dont specify a release im pretty sure it just uses the latest one
<FromGitter>
<Daniel-Worrall> That's not what I'm saying the problem is. It's misidentifying an old commit as a release tag and not overwriting the lib folder
teardown has quit [Ping timeout: 276 seconds]
duane has joined #crystal-lang
<FromGitter>
<Daniel-Worrall> Can shards pull from private repos
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 240 seconds]
<FromGitter>
<watzon> I believe so. Shards uses git, so you would have to have a key configured probably.
duane has quit [Ping timeout: 268 seconds]
teardown has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> Is there something equivalent to PHP's `mysqli_real_escape_string` for Crystal?
ht_ has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
_whitelogger has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> i guess ` update table set field = ?` is probably ideal. i'll just use this as i think it's safer (prepared statements?)
go|dfish has quit [Ping timeout: 250 seconds]
ht_ has quit [Quit: ht_]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Remote host closed the connection]
DTZUZO has joined #crystal-lang
go|dfish has joined #crystal-lang
raz has joined #crystal-lang
<raz>
small suggestion: it would be great if the api-docs would have a clickable version-switcher at the top (because google returns links to pretty much random api versions depending on what you search for)
OvermindDL1 has quit [Quit: Connection closed for inactivity]
<FromGitter>
<tenebrousedge> There's a similar syntax for named elements that takes a hash
<FromGitter>
<tenebrousedge> %s means that you're passing in a string. There's also %d for integers, and %f for floats. You can control how many significant digits get printed if you need to
<FromGitter>
<tenebrousedge> the `&->object.methodName(ArgumentClass)` syntax is just a short way to reference a method defined on a given object
<FromGitter>
<tenebrousedge> `map` is a thing. But you'd probably do `batch.map &.parse.normalize.transform`
<FromGitter>
<tenebrousedge> or `.try &.parse.try &.normalize.try & .transform` depending
<FromGitter>
<tenebrousedge> if you really really want to use class methods for this, then the `&->` syntax you had would be correct
<FromGitter>
<tenebrousedge> Ruby `then` -> Crystal `try`, for the most part
<FromGitter>
<tenebrousedge> and `&->object.method(Arg)` is equivalent to Ruby's `method`, or seemingly this short syntax
<hightower2>
oo good one
<FromGitter>
<Daniel-Worrall> I have some pseudo code here. Is there a way I can move the common code so that it's not repeated, isn't its own method and isn't run on the else case ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5dc1acd17477946bad33a530]
<FromGitter>
<Daniel-Worrall> and also without another redundant comparison
<FromGitter>
<asterite> Yeah, but I mean, the only thing that you save there is having to choose a name for the arg, and maybe a few characters. I'm also pretty sure in Ruby `method` and then `&` are slower than the arg+call approach, the same way using `&:downcase` is slower than `|x| x.downcase`
<FromGitter>
<asterite> we could always introduce named block args like in Ruby... `select { "ACEG".downcase.include?(@1) }`
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter>
<vlazar> yes, Ruby's `&` with `method` is much slower (10x slower in article, 20x slower for me with code from article)
<FromGitter>
<tenebrousedge> `method` is slower, but it allows you to manipulate the object
<FromGitter>
<tenebrousedge> and manipulate it outside the loop
<FromGitter>
<tenebrousedge> which named block args would not do
<FromGitter>
<vlazar> @asterite it's now `select { "ACEG".downcase.include?(_1) }` in Ruby :)
<FromGitter>
<asterite> Oh, I'm glad they changed the syntax, the `@` was very noisy
<FromGitter>
<vlazar> yeah, me too, but numbered params still feel a bit weird
<FromGitter>
<vlazar> > If it will be multiple params @1, @2, etc. Can we also have @ aliasing @1? I think it's going to be a common use case to just have the one param.
<FromGitter>
<asterite> It's interesting because `_1` is a valid variable name in Ruby, so they are just introducing a breaking change
<FromGitter>
<asterite> It's also interesting to learn that they added `...` as a way to forward all arguments
<FromGitter>
<asterite> (unrelated, but still...)
<FromGitter>
<watzon> +1 for named arg blocks
<FromGitter>
<vlazar> comment by Matz ⏎ ⏎ > The problem is introducing `it` or `this` could break existing code. That is the problem. Numbered parameters are a compromise to simplify block expression without breaking compatibility.
<FromGitter>
<vlazar> `it` as for implicit(first) block argument
<FromGitter>
<watzon> If anyone has thoughts on #8441 please make them known. My friend @Zenohate is probably going to PR the Float::Printer so that it uses the Ryu algorithm over Grisu3, which should offer a significant performance increase
<Yxhuvud>
asterite: while _1 is a valid variable name in ruby, variables starting with _ has the meaning that they are not used (you won't get a warning if you don't use them, as opposed to normal local variables). so the risk of conflict is pretty small.
<FromGitter>
<asterite> I see
<FromGitter>
<bajro17> What mode I can use to create folder
<FromGitter>
<bajro17> I try File.write("template/index/index.html", string, mode: "a")
<FromGitter>
<bajro17> but it dont create folder
sorcus has quit [Ping timeout: 264 seconds]
<FromGitter>
<tenebrousedge> You probably want `FileUtils.mkdir_p`
<FromGitter>
<Blacksmoke16> `filename will be created if it does not already exist.` i guess that doesn't include creating directories as well
<FromGitter>
<tenebrousedge> I wouldn't expect it to
<FromGitter>
<tenebrousedge> @bajro17 use the named sprintf syntax
<FromGitter>
<kinxer> @christopherzimmerman Why not just have a class/struct as your instance variable and instantiate a different one depending on what you need?
<FromGitter>
<kinxer> Btw, does IRC get the rendered Markdown somehow or just the raw text before rendering?
<FromGitter>
<tenebrousedge> I don't see what difference it makes to use a class vs. a proc
<FromGitter>
<tenebrousedge> but w/e
<FromGitter>
<kinxer> I think it's cleaner if you have a lot of logic. Also, proc syntax is ugly.
<FromGitter>
<christopherzimmerman> The getter would work, but then I'm still checking that flag each time I call next. I was hoping I could set it just once.
<FromGitter>
<tenebrousedge> @christopherzimmerman the block is automatically memoized
<FromGitter>
<tenebrousedge> it's only evaluated once
<FromGitter>
<kinxer> Very cool. I didn't know the compiler did that.
<FromGitter>
<christopherzimmerman> I thought I could set the proc in the init method, but then the function tries to access invalid memory each call so it must be losing its scope
woodruffw has joined #crystal-lang
<FromGitter>
<christopherzimmerman> On the bright side, as soon as I get this figured out, most of my operations will be as fast or faster than `numpy`, really loving Crystal's performance
<FromGitter>
<wontruefree> tomorrow talk on data streams
<FromGitter>
<wontruefree> favorite quote "the compiler does not bite"
<hightower3>
If crystal version is mentioned in shard.yml, does it serve as a minimum version check, or it's used for some other purpose?
<FromGitter>
<Daniel-Worrall> it currently serves as a "last known working on" descriptor, but crenv (a crystal version manager) uses it to choose which crystal to run
<hightower3>
Cool, thanks
ht_ has quit [Quit: ht_]
go|dfish has quit [Ping timeout: 250 seconds]
<FromGitter>
<bajro17> I wish I can go
<FromGitter>
<bajro17> @wontruefree there will be stream?
go|dfish has joined #crystal-lang
<FromGitter>
<kinxer> @christopherzimmerman @tenebrousedge This is what I came up with: https://gist.github.com/kinxer/e605abc62b91beba58ebd9c6730f978a. I don't know how accurate my benchmarking is, but it's at least a scaffold that y'all could use to iterate further.
<FromGitter>
<kinxer> The macros and modules are just for code reuse within the benchmark.
<hightower3>
What's the most elegant way to read content line by line, periodically checking if something new came in?
<hightower3>
I have an open File, and am at the end of its current content
<FromGitter>
<lbarasti> Are constants hoisted in Crystal? Is that documented somewhere? ⏎ ⏎ ```a = 2 ⏎ N = a ⏎ puts N``` ⏎ ⏎ fails compilation with: `error in line 2 Error: undefined local variable or method 'a' for top-level` [https://gitter.im/crystal-lang/crystal?at=5dc209099825bd6bac334803]
HumanGeek has joined #crystal-lang
<FromGitter>
<tenebrousedge> constants are evaluated first, pretty sure
<FromGitter>
<watzon> ^
HumanGeek has quit [Remote host closed the connection]
<FromGitter>
<watzon> They are
HumanGeek has joined #crystal-lang
<FromGitter>
<tenebrousedge> hightower, that kinda sounds like a fiber-y channel-y thing
<FromGitter>
<lbarasti> Thanks @tenebrousedge @watzon for confirming
<FromGitter>
<tenebrousedge> it does seem like a good thing to mention
<FromGitter>
<watzon> It probably should be specified in the docs what actually constitutes a constant
Human_G33k has quit [Ping timeout: 265 seconds]
<FromGitter>
<lbarasti> OK, I'll look into that, maybe just an example will do.
<FromGitter>
<ImAHopelessDev_gitlab> is it possible to code in an OOP language and a functional one? how is it possible, let alone the core developers ary and brian both code in haskell
<FromGitter>
<ImAHopelessDev_gitlab> what do you need to do, to understand both
<FromGitter>
<tenebrousedge> functional languages are rarely pure, and any language that has first-class functions should be able to use all of the other functional constructs. So in theory, most programmers are using both at the same time