Ven`` has quit [Read error: Connection reset by peer]
alex`` has joined #crystal-lang
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Raimondii has joined #crystal-lang
mitch has joined #crystal-lang
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
mitch has quit [Quit: Page closed]
Ven`` has joined #crystal-lang
<FromGitter>
<alex-kampa> @bararchy thanks for the suggestion re SushiChain, there may be a couple of useful elements for us there. Sikoba z-nodes is not a typical blockchain project though, this will be a generic state machine replication architecture with pluggable consensus, with blockchain only used to ensure immutability of history. A bit like Tendermint, but with some additional features.
<FromGitter>
<bararchy> @alex-kampa sounds interesting, what real world use cases would this project handle? What unique features are you planning ? :)
thews has joined #crystal-lang
thews has joined #crystal-lang
thews has quit [Changing host]
<FromGitter>
<ok2094> Does crystal allow inheritance of multiple classes?
<RX14>
no
<RX14>
you probably want modules
<FromGitter>
<alex-kampa> @bararchy - we are doing this for a project called "sikoba" (cf https://www.reddit.com/r/sikoba/wiki/docs) for which we have not found a suitable platform - projects like Tendermint and Babble come close, but do not have all the features we need. And we think our approach could be useful for other consortium blockchain projects.
<FromGitter>
<alex-kampa> The two unique features will be 1) initial user access without private key or wallet, removing a significant hurdle for product adoption 2) pluggable consensus, allowing to even have different consensus mechanisms for different functions during each block cycle.
<FromGitter>
<alex-kampa> The latter we need for something I call "optimisation consensus protocol", where the nodes compete by each working independently on a (useful) hard-to-solve problem for a limited period of time.
<FromGitter>
<alex-kampa> This requires several different consensus rounds before producing a single block.
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax has joined #crystal-lang
greenbigfrog has quit [Ping timeout: 255 seconds]
IMnotARobot has joined #crystal-lang
<IMnotARobot>
hey
IMnotARobot has quit [Client Quit]
commavir has quit [Ping timeout: 255 seconds]
commavir has joined #crystal-lang
commavir has quit [Ping timeout: 255 seconds]
commavir has joined #crystal-lang
greenbigfrog has joined #crystal-lang
commavir has quit [Ping timeout: 255 seconds]
commavir has joined #crystal-lang
<hightower2>
I have the following problem: if I define property x : Array(Type1) , and I later do obj.x = [ type1 objects... ], all is good and works without me specifying the type of []. But if I just extend that to property x : Array(Type1 | Type2), suddenly I can no longer write obj.x= [ type1 objects ] because the compiler complains: instance variable '@x' must be Array(Type1 | Type2), not Array(Type1)
<hightower2>
Is there a way to avoid this?
greenbigfrog has quit [Ping timeout: 256 seconds]
<FromGitter>
<gdotdesign> this is a workaround I think `obj.x = [type1 objects] of Type1 | Type2`
<FromGitter>
<gdotdesign> I had the same problem with hashes a while back
commavir has quit [Ping timeout: 256 seconds]
commavir has joined #crystal-lang
<hightower2>
Yes, yes, my problem is exactly that I want to avoid having to write "of Type1 | Type2" at every places where I assign to x
<hightower2>
It is strange that for one type, it doesn't require it, but for multiple types it does, even though the arguments are clearly implicitly castable into defined type(s)
commavir has quit [Ping timeout: 260 seconds]
Ven`` has joined #crystal-lang
commavir has joined #crystal-lang
<FromGitter>
<yxhuvud> Hmm. I wonder if that behavior will change when the literal automatic type conversion changes is released.
commavir has quit [Ping timeout: 265 seconds]
<hightower2>
I'm aware of that PR but somehow thought it doesn't affect this case specifically. It's worth trying out, though.
<oprypin>
yxhuvud, the changes are all merged to master
<oprypin>
and they will not make this better
<oprypin>
in fact, a different change made it slightly "worse"
<oprypin>
because there were some cases where what you wrote might even work under some circumstances but that's mostly accidental
<oprypin>
you do have to write `of`, that's the best right now
<oprypin>
maybe the literal-related changes could pave the way towards improving this but i wouldn't hold my breath
<hightower2>
ahh... ok, thanks
<oprypin>
oops wrong tag i guess
<hightower2>
I am going to try to avoid the problem by pushing to an array rather than replacing it
<hightower2>
So instead of doing x = [1,2,3] of T1 | T2, I am just going to do x<< [1,2,3]
<hightower2>
This will help in at least part of the cases where this is bugging me now
Ven`` has quit [Read error: Connection reset by peer]
Ven` has joined #crystal-lang
<RX14>
planning on streaming to try out my parallelism ideas today
duane_ has quit [Ping timeout: 255 seconds]
commavir has joined #crystal-lang
<Vexatos>
Nice.
greenbigfrog has joined #crystal-lang
Ven` has quit [Ping timeout: 276 seconds]
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jeromegn>
RX14: where do you stream? Would love to watch.
<RX14>
Twitch
<jeromegn>
same username?
<RX14>
yeah
<livcd>
when ? :)
<RX14>
sometime after lunch
<livcd>
UK time i assume ?
<RX14>
more like my stomach time
Ven`` has joined #crystal-lang
duane has joined #crystal-lang
Ven`` has quit [Read error: No route to host]
Ven`` has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
faustinoaq has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Client Quit]
Philpax has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
woodruffw has quit [Excess Flood]
woodruffw has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has quit [Changing host]
<FromGitter>
<ryankshah> How can I just get the header information from a CSV file without reading it all in?
<FromGitter>
<ryankshah> @z64 Thanks for the clarification :)
<FromGitter>
<ryankshah> what type would `headers` be?
<z64>
Array(String)
<FromGitter>
<ryankshah> And finally, does `File.read` read the contents of the file into `raw`?
<z64>
not sure what you mean by `raw`. File.read returns a String of the files contents
<FromGitter>
<ryankshah> The thing is, my files will be extremely large and I only need the headers because I will perform operations on the data of the csv line-by-line
<z64>
right. which is why you pass CSV.new an IO
<z64>
(dont use File.read)
<FromGitter>
<ryankshah> How could I use an IO in this case?
<z64>
i.e. `File.open("data.csv", "r") { |file_io| CSV.new(file_io...) }`
<FromGitter>
<ryankshah> Is there a place where I can check the syntax for that?
<FromGitter>
<ryankshah> I can't find it in File in docs
<FromGitter>
<ryankshah> wait
<FromGitter>
<ryankshah> My undergrad java { \n } block kicked in, it has to be on one line
<z64>
o
<FromGitter>
<ryankshah> rip
<z64>
what were you confused about though? the block syntax? `foo { |var| ... }`?
<FromGitter>
<ryankshah> No the syntax is not confusing at all, my brain is fried from submitting my PhD application and my brain reverted to OOP code style and i wrote it like this: ⏎ ⏎ ```File.open("data.csv") { ⏎ |io| ... ⏎ }``` [https://gitter.im/crystal-lang/crystal?at=5afaef5841f54f22e22f367e]
<z64>
oh okay
<FromGitter>
<ryankshah> Thanks for the help though!
<z64>
if you're doing multiline block though, you should use `do..end` instead
<z64>
no problem
<FromGitter>
<ryankshah> I'll keep that in mind, but the single line block should be suffice
<z64>
yep
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has quit [Remote host closed the connection]
<FromGitter>
<fridgerator> LOL, i kept hearing sounds coming from my computer and couldnt figure out what it was
<FromGitter>
<fridgerator> your twitch link started auto-playing
<FromGitter>
<ryankshah> LOL
<FromGitter>
<ryankshah> same here
<FromGitter>
<ryankshah> i thought I was going mad
<FromGitter>
<fridgerator> why in the F am I hearing keyboard clicking noises and talking
<FromGitter>
<fridgerator> 😆
<FromGitter>
<bew> This way you can't miss it ^^
<FromGitter>
<ryankshah> xD
<FromGitter>
<ryankshah> @RX14 taking the promotion of the language to new extremes
<RX14>
it shouldn't auto play
<Vexatos>
Thanks gitter
alex`` has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<f1refly>
Is there a way to launch a terminal editor ($EDITOR) from my crystal program and wait for it to close? I played around with the Process class but couldn't figure it out
<f1refly>
Is there documentation about this somewhere? I think about something git-esque
hmans has joined #crystal-lang
<hmans>
\o/
<FromGitter>
<hmans> \o/
<jsn->
f1refly, system(), as usual
snsei has joined #crystal-lang
<FromGitter>
<LVMBDV> which pastebin should i use for crystal code?
<FromGitter>
<LVMBDV> i expect it to return an array of MetaVars but it doesn't, maybe that information isn't available at compile-time (when macros are run?)
<FromGitter>
<bew> macros in methods are expanded after the compiler typed everything
<FromGitter>
<LVMBDV> how about macros in methods defined in macro methods?
<FromGitter>
<bew> macros in top level could still creates new types, add new instances vars to types, so there is no reliable way to get the instance vars until the compiler typed things
<FromGitter>
<bew> you can't have a method in a macro method, the macro method is already the method x)
<FromGitter>
<bew> but yeah, you can use `TypeNode#instance_vars` from a 'macro method' (a method with some macro in it iirc)
<FromGitter>
<LVMBDV> hmm, let me present the tricky part
<f1refly>
oprypin: when i try to launch the editor with Process.new, it comes up for a splitsecond and then vanishes into the background. I can still see it in htop, so it keeps running
<oprypin>
i'm not sure how it's possible for an editor to appear
<oprypin>
I don't think you have an executable called "${FCEDIT:-${VISUAL:-${EDITOR:-vi}}}" in your PATH
<oprypin>
lol but it actually works for me
<oprypin>
and it doesnt disappear
<oprypin>
what is even going on
<oprypin>
ah of course! shell: true
<oprypin>
prefer not to use that if possible
<f1refly>
it searches for your preffered editor
<f1refly>
and checks all the editor variables
<f1refly>
with vi as fallback
<oprypin>
yeah that's not the problem
<oprypin>
f1refly, do you intend the crystal program to keep running after you started the editor?
<oprypin>
do you intend to wait for the editor to finish?
<f1refly>
i want it to wait
<f1refly>
i saw the wait command obviously
<oprypin>
so use `.run` instead of `.new`
<oprypin>
that's like new and wait
<oprypin>
that should fix igt
<f1refly>
god, i wish they'd teach this in school or uni
<f1refly>
this ruby syntax is so alien when you didn't learn about it from somebody
<f1refly>
do you know if there are sites that do crystal code reviews?
<oprypin>
you're on it
<oprypin>
ok i think you should be good here. maybe using the shell is a good idea, after all
<f1refly>
yes, it doesnt work otherwise
<FromGitter>
<bew> Oo why?
<oprypin>
because for me I have the editor set to "kate -b" and of course there's no such executable called "kate -b" so we let the shell figure it out
<FromGitter>
<bew> ah right
<f1refly>
tput works without the shell = true for some reason
<oprypin>
well i told you why that thing doesnt work without shell
<oprypin>
[21:25:44] <oprypin> I don't think you have an executable called "${FCEDIT:-${VISUAL:-${EDITOR:-vi}}}" in your PATH