jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <j8r> It is not what you want, right?
deavmi has quit [Ping timeout: 256 seconds]
<FromGitter> <j8r> Likely not what you want too 😅
<FromGitter> <watzon> Not quite. I want to take a method that takes a block, and wrap that up in an iterator.
<FromGitter> <watzon> Basically the use case is like what straight-shoota was talking about here (https://forum.crystal-lang.org/t/automatic-iterators/2001/5?u=watzon). I want to have a method that takes a block, and a method that returns an iterator.
<FromGitter> <watzon> Like `each(&block)` and `each : Iterator(T)`
<FromGitter> <j8r> Possible with the POC
<FromGitter> <j8r> Another option is make your own
<FromGitter> <j8r> Would be the best
deavmi has joined #crystal-lang
<FromGitter> <j8r> To do so, you have to store somwhow the parsing state
<FromGitter> <watzon> Yeah it's not worth that much to me haha
<FromGitter> <watzon> Just would be a nice thing to have
<FromGitter> <dscottboggs_gitlab> ```code paste, see link``` ⏎ ⏎ Why is this? [https://gitter.im/crystal-lang/crystal?at=5eeea94b3a0d3931faa48b17]
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <j8r> @watzon in the future the compiler could be able to automatically generate iterators
<FromGitter> <j8r> Constructed with inline loops
zorp_ has quit [Ping timeout: 246 seconds]
<FromGitter> <watzon> That would be a wonderful thing
<FromGitter> <watzon> So it appears as though `URI#relativize`doesn't make absolute urls like `/foo` relative to the given URI? Seems as though they just stay the same rather than becoming `./foo`.
<FromGitter> <watzon> Made an issue in case anyone cares to comment https://github.com/crystal-lang/crystal/issues/9521
<FromGitter> <Daniel-Worrall> I could have sworn there was a crystal tool format thing for vscode
<FromGitter> <wyhaines> That would be handy.
<FromGitter> <wyhaines> I really wish that there was good Crystal support for RubyMine instead of just having to leverage the Ruby syntax checking. I love RubyMine, but it seems like vscode is the only editor that has decent support (although it was a huge hassle to get it to work with a Crystal that is installed on WSL1).
<FromGitter> <watzon> @Daniel-Worrall there is though
<FromGitter> <Daniel-Worrall> Mine doesn't seem to be working
<FromGitter> <watzon> If you have the Crystal Language plugin made by Faustino it should work
<FromGitter> <Daniel-Worrall> I have the Crystal Language plugin
<FromGitter> <Daniel-Worrall> maybe it's a windows misconfiguration thing
<FromGitter> <Daniel-Worrall> since I moved to WSL2
<FromGitter> <watzon> Hmm could be
<FromGitter> <Daniel-Worrall> ty, I wasn't going crazy
<FromGitter> <Daniel-Worrall> Well, at least I'm getting output now
<FromGitter> <Daniel-Worrall> `Error executing Crystal plugin. spawn crystal ENOENT`
_whitelogger has joined #crystal-lang
<FromGitter> <Daniel-Worrall> `wsl.exe -e bash -c "/home/d/.anyenv/envs/crenv/shims/crystal %*"`
<FromGitter> <Daniel-Worrall> settling on this
<FromGitter> <Daniel-Worrall> actually wtf am I doing ... just`bash -c "/home/d/.anyenv/envs/crenv/shims/crystal %*"`
<FromGitter> <watzon> Well you're using WSL2 now, right?
<FromGitter> <watzon> You shouldn't have to hack around it like that with WSL2 if you have the "Remote -WSL" extension installed.
<FromGitter> <Daniel-Worrall> Hah
<FromGitter> <Daniel-Worrall> No way am I running VSCode in Remote - #WSL
<FromGitter> <Daniel-Worrall> overhead city
<FromGitter> <thelinuxlich> I do it
<FromGitter> <thelinuxlich> but with WSL 2
<FromGitter> <Daniel-Worrall> I have WSL 2
<FromGitter> <watzon> Overhead? It's not that bad haha
<FromGitter> <watzon> All it does is runs code in the WSL context instead of Windows
<FromGitter> <Daniel-Worrall> and the filesystem
_whitelogger has joined #crystal-lang
<FromGitter> <watzon> Ok, well I just completely rewrote Arachnid and got it working with Crystal 0.35.1. Still need to do some work on making things concurrent, but the code is much cleaner than previously since this is fully original code rather than being a port of a Ruby library.
<FromGitter> <watzon> Gonna work on updating Marionette next and then create an HTTP::Client wrapper for it so that it Arachnid can be used with it.
_whitelogger has joined #crystal-lang
<FromGitter> <grkek> Nice
r0bby has joined #crystal-lang
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
alexherbo2 has joined #crystal-lang
Jesfre has quit [Quit: Leaving]
oddp has quit [Ping timeout: 246 seconds]
<jhass> twosecslater: which OS are you using? :)
<twosecslater> Alpine
<jhass> ah
<jhass> I think mps wants to push a aarch64 package to repos today :D
<twosecslater> ah, very convenient
<twosecslater> shards as well?
<jhass> idk
<jhass> meanwhile, what you can do is get this branch https://github.com/jhass/crystal/tree/gha_aarch64_ci
<jhass> and the static binary from https://dev.alpinelinux.org/archive/crystal/
<jhass> place it at .build/crystal
<jhass> run make deps
<jhass> and use the bin/crystal wrapper
<mps> jhass: yes, I'm just preparing your patches for building 0.35.1 on aarch64
<jhass> I think not all of them are in their most recent version in there, because it wasn't important to incoorporate the review feedback in there
<mps> I think #9401 #9422 and #9430 are enough
<DeBot> https://github.com/crystal-lang/crystal/pull/9401 (Disable LLVM Global Isel) | https://github.com/crystal-lang/crystal/pull/9422 (Fix VaList and disable va_arg for AArch64) | https://github.com/crystal-lang/crystal/pull/9430 (Fix C ABI for AArch64)
<jhass> and then that also includes stuff non-essential to aarch64 support but fixing up specs
<jhass> yes, eactly, they are
<mps> thanks for confirmation
<mps> last night we had issue with machine at packet and it restarted
<jhass> aww
<mps> and I put my effort to upgrade kernel for alpine to 5.7.4, finished that about hour ago
<jhass> I pocked a bit at patching up Crystal's armv7/armhf support the other day
<jhass> unfortunately it looks more broken than I hoped
<mps> uhmm, we still have disk problem with aarch64 dev machine on packet premise
<jhass> aww, too bad
<mps> well, hope it will be fixed today
f1refly has quit [Quit: bye fags]
<FromGitter> <lbarasti> Hi, has 0.35 been released on Ubuntu? after an `apt update` and `apt install crystall` I get ⏎ ⏎ ```crystal is already the newest version (0.34.0-1).``` [https://gitter.im/crystal-lang/crystal?at=5eef3a83c223cc536a282118]
<FromGitter> <j8r> I hope this pacthes will land to 1.0.0 at least
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<mps> when is 1.0 expected?
<FromGitter> <j8r> Don't know exactly, several months probably
<FromGitter> <j8r> master is `1.0.0-dev`
<mps> aha, good
<mps> it will be probably ready for next Alpine stable release
<mps> j8r: did you had any progress on your armv7 porting work
<mps> jhass: I'm finishing upgrade to 0.35.1 for alpine linux with your patches, and I would like to mention you and your work in git commit message. do you agree?
<jhass> sure, as you prefer :)
<mps> something like 'add patches made by Jonne Hass on https://github.com/crystal-lang/crystal/pull/9508 to get aarch64 again'
<jhass> Haß ;P
<mps> just wanted to ask you about 'ß', I don't have it on my keyboard :)
<mps> thanks
<mps> I learned 3 years German in school
<jhass> uh another one
<jhass> always scary how many do
<jhass> where you're based?
<mps> you mean where I live? In Serbia
oddp has joined #crystal-lang
<jhass> <3
<FromGitter> <j8r> mps no, I struggled to cross compile, then I moved to other things
<FromGitter> <j8r> AFAIK ß can often be replaced by ss
<FromGitter> <j8r> In Switzerland even more
<mps> not in 'hochdeutsch' afaik
<mps> j8r: I understand, it is not easy port it (crystal) from 64bit arches to 32bit ones
<jhass> ss and sz are valid replacemnts for technical reasons, but just that, replacements :)
<mps> for those who need it crystal-0.35.1-r0 is in alpine edge now :)
<mps> aarc64, I mean, besides x86_64
<jhass> 🎉
<mps> is this '🎉' emoji wine symbol ;)
<jhass> wine? :D
<mps> uhm, I always thought it is ice cream :)
<jhass> haha :D
<jhass> time for a better emoji font? xD
<mps> in my irrsi IRC clients and Symbola fonts it looks like ice cream
<jhass> yeah, linux still lacks a good terminal supported emoji font. Last time I checked anyways
<mps> there are some packaged, but I like simple ones
<jhass> https://github.com/googlefonts/noto-emoji ain't too bad but renders too big in my terminal iirc
<mps> yes, font-noto-emoji is packaged for alpine but I don't use them
<jhass> I like it just because it's the android one, so some standard to it
<jhass> I wish they would be standardized better honestly, they can look so different across platforms
<mps> yes, and pkg is big
<jhass> eh, that's nothing I care too much about, storage is cheap
<jhass> >> Crystal::VERSION
<DeBot> jhass: # => "0.35.1" - https://carc.in/#/r/9b31
<oprypin> why cant text editors just group opened files by the originating directories, .. like how hard can it be
<oprypin> not the freakin useless TABS which everyone seems to use.. like they're completely useless
<oprypin> Kate remains the one and only 😌 https://i.imgur.com/LEg7HYx.png
<bougyman> I never use tabs.
<bougyman> I <3 ctrlspace
<bougyman> haha, it's the first demo on http://vim-ctrlspace.org/ "Grouping Files"
<jhass> I've turned off tabs in sublime and recently got a plugin that continously sorts the the open files sidebar by MRU
<yxhuvud> I am fairly certain my emacs sort buffers by LRU order. Which is a behaviour I like and I don't know how grouping would make sense in that context.
<oprypin> Kate has LRU coloring and directory-tree grouping
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
yxhuvud has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<FromGitter> <didactic-drunk> How do I get a non-nillable T from: ⏎ ⏎ ```class C(T)``` [https://gitter.im/crystal-lang/crystal?at=5eef963747fdfd21edd87cb2]
<FromGitter> <Blacksmoke16> Reject Nil from the generic types?
<jhass> property! x : T
<FromGitter> <didactic-drunk> `C(T)` is a generic class that takes nillable input, filters out `nil` and sends to `Channel(T - nil)` that it instantiates.
<jhass> typeof(T.new.not_nil!) xD
<jhass> (nah, that won't work)
<jhass> does C *always* take nilable input?
<FromGitter> <didactic-drunk> T may be a union.
<jhass> maybe T does not need to include Nil in the first place but you can type stuff as T?
<FromGitter> <didactic-drunk> Not always.
<jhass> typeof(Array(T).new.first.not_nil!) would probably actually work but there's also a saner way to all this, but idk, I don't have enough material in the question to think on
<jhass> I mean but I'm sure there's
<FromGitter> <Blacksmoke16> could prob do something like `Union("#{T.type_vars.reject(&.==(Nil)).splat}")`
<FromGitter> <didactic-drunk> Trying to filter nils from `.batch`. Usage is: ⏎ ⏎ ```(1..50).parallel.select { }.map { }.batch(100).run { }``` [https://gitter.im/crystal-lang/crystal?at=5eef98547ba3965373be5f3b]
<FromGitter> <didactic-drunk> `T` comes from `map` or potentially other places like a `union` `Channel`.
<jhass> you really hate vowels, eh? :P
<jhass> so it doesn't currently, you would do ary << o unless o.nil?
<jhass> ?
<jhass> mh, srsly, Channel(Array(typeof(src_vch.receive.not_nil!S)).new
<jhass> eh, minus the S
<FromGitter> <didactic-drunk> Yes, and `class Batch(S) < Base(Array(S - Nil))`
<jhass> not sure it's possible
<FromGitter> <didactic-drunk> What of something like `output = Batch(T, {{ Union("#{T.type_vars.reject(&.==(Nil)).splat}") }}).new @dst_vch, @dst_ech, batch_size: size`
<jhass> whatever works for you I guess
<FromGitter> <didactic-drunk> @jhass Got it using your suggestion.
yxhuvud has joined #crystal-lang
f1refly has joined #crystal-lang
<twosecslater> hm, I've installed crystal and shards from the edge community repo (thank you very much mps btw), although I can't seem to build anything, here's the error output I get: https://bin.snopyta.org/?3e771152f2617f0c#6spTbWtkWXk7joQAj4hkSF9q2YPJhdN8tAc4GHodHTeS
<FromGitter> <thelinuxlich> does Crystal support destructuring Hash?
<mps> twosecslater: this url is encrypted?
<twosecslater> no, I believe it's just the ID for my paste
<mps> I can't open it
<twosecslater> alrighty, here's a hastebin: https://hastebin.com/raw/oqomemeteb
<mps> this looks some dependencies missing
<mps> did you installed alpine-sdk
<twosecslater> ah, that did it. yeah I didn't know I had to have that installed, thanks
<mps> that is metapackage which install most basic development 'things'
<twosecslater> I see, good to know
f1refly has quit [Ping timeout: 244 seconds]
f1refly has joined #crystal-lang
<FromGitter> <thelinuxlich> no String.trim in Crystal?
<jhass> >> " it has ".strip
<DeBot> jhass: # => "it has" - https://carc.in/#/r/9b4s
<FromGitter> <thelinuxlich> oh thanks!
<jhass> destructuing is very basic right now, a, b, c = x is rewritten to a = x[0]; b = x[1]; c = x[2]
<FromGitter> <thelinuxlich> oh okay
<mps> Blacksmoke16: oq 1.1.0 fails in 'crystal spec' with crystal 0.35.1 on alpine
<FromGitter> <Blacksmoke16> 😬 whats the error?
<mps> here it is https://tpaste.us/yZLn
<FromGitter> <Blacksmoke16> oo thanks, i need to release `1.1.1`
<mps> I'm not in a hurry, just wanted to inform you. when you find time ...
<FromGitter> <Blacksmoke16> thanks, ill ping you when its done
<mps> good, thanks
<oddp> Coming from dlang and taking another look at crystal, this distinction between iterators and enumerables (and also ranges to some extend) leaves a bad taste. Providing only seemingly overhead-free lazy iterators in conjunction with collection methods such as .to_a, .to_h and so on, would have truly been the cherry on top of everything else crystal provides so far. But constantly having to remember whether some function is exclusively available for ranges,
<oddp> arrays/enumerables, etc. is cumbersome. And on top of that, some iter functions, for example, return arrays which once again forces you to juggle constructs such as `foo.each.bar.each_baz.each.bunz` if you want to stay in lazyland.
<FromGitter> <didactic-drunk> I agree `Enumerator.most_methods` should return `Enumerator`. It's confusing what runs or doesn't.
<FromGitter> <Blacksmoke16> @mps `1.1.1` is released now
<mps> Blacksmoke16: you are fast. thanks :)
<FromGitter> <Blacksmoke16> np, thank you
<mps> Blacksmoke16: new error in check specs, https://tpaste.us/Ypy4
<mps> again, I'm not in hurry, so easy :)
<FromGitter> <Blacksmoke16> ogh, stupid yaml specs
<mps> yes :)
<FromGitter> <Blacksmoke16> what version of libyaml is installed when running those?
<mps> yaml-dev-0.2.5-r0 = 0.2.5-r0
<FromGitter> <Blacksmoke16> https://github.com/yaml/libyaml/pull/186 rip
<FromGitter> <Blacksmoke16> ok
<mps> hah, I see
<FromGitter> <Blacksmoke16> i imagine you want that fixed?
<FromGitter> <Blacksmoke16> might rework some of the specs to avoid this in the future, 2nd time it happened ha
<mps> again, we are not in a hurry. I'm going to bed in few minutes so whenever you do it is ok
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <sam0x17> how can I add a test-only dependency to `shard.yml` ?
<FromGitter> <Blacksmoke16> would have to add them as development dependencies
<FromGitter> <sam0x17> follow-up question: once something is added as a development dependency, how do I install it as shards install seems to skip it
<FromGitter> <Blacksmoke16> `shards install`
<FromGitter> <sam0x17> aha
<FromGitter> <sam0x17> I was writing `dev_dependencies` instead of `development_dependencies`
<FromGitter> <Blacksmoke16> that would do it
<oprypin> jhass, maybe you can help me out again 🙏 this is about https://github.com/crystal-lang/crystal/blob/master/src/llvm/abi/x86_win64.cr
<oprypin> https://gist.github.com/b064d6601138e194e33b054d50a96a10 has first the Cyrstal code snippet, and in the diff the red part is what Crystal generates (wrong) and green is what I do to correct it manually (works)
<oprypin> what is the problem there?
<oprypin> jhass, oh wow! `ArgType.indirect(t, nil)` makes Crystal->C work correctly, while `ArgType.indirect(t, LLVM::Attribute::ByVal)` makes C->Crystal work correctly
zorp_ has joined #crystal-lang
<FromGitter> <wyhaines> Pseudo-terminals -- pty -- is there any existing Crystal facility to do things similar to this: https://ruby-doc.org/stdlib-2.7.1/libdoc/pty/rdoc/PTY.html
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
<oprypin> tl;dr
<FromGitter> <yorci> what is changed between 0.35.0 and 0.35.1, it was 9mb binary file compiled with 0.35.0 and i just get a new release with 0.35.1 and its just 1.6mb 😄
<FromGitter> <yorci> impressive
<FromGitter> <Blacksmoke16> I don't think that was intentional...
<FromGitter> <yorci> well, i didnt see any optimization note in change log actually but idk why it reduces that much
<FromGitter> <Blacksmoke16> Seems kinda odd
<FromGitter> <yorci> i just change json.map to json::serializable, could be?
<FromGitter> <Blacksmoke16> I would doubt it?
<FromGitter> <yorci> 😄