<FromGitter>
<MrSorcus> Maybe i'm looking for something like `HTTP::Client.get("example.com", my_own_socket)`
vivus has quit [Quit: Leaving]
hightower has quit [Ping timeout: 256 seconds]
<cptaffe>
A major pain point to me is that `JSON::Any` consumes the `JSON::PullParser` and the only way to build a new `JSON::PullParser` is to call `to_json` and re-parse it into the type you want.
<cptaffe>
I ran into this issue using the postgres driver for crystal-database, where jsonb columns are consumed as `JSON::Any`
<cptaffe>
It seems that classes which parse from json should consume a `JSON::Any` instead of a `JSON::PullParser`, or that it should accept some interface which `JSON::Any` and `JSON::PullParser` implement
cremes has quit [Quit: cremes]
baweaver is now known as baweaver_away
baweaver_away is now known as baweaver
dragonkh has joined #crystal-lang
never_ has joined #crystal-lang
<never_>
is it possible to make a class alias ?
<never_>
I tried doing this alias : Scene = BaseScene | {BaseScene, Scene}
<never_>
and I got a nice recursive struct error (which I understand)
<never_>
in Rust I would just make it a pointer but I wonder if there's not a more idiomatic way
<never_>
forgive me, I'm bad at OOP
<never_>
(BaseScene is a class)
<never_>
nvm I figured it out - you can just put the alias in a class and it works =) thanks !
dragonkh has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
dragonkh has joined #crystal-lang
mark_66 has joined #crystal-lang
mark_66 has left #crystal-lang ["PING 1517215811"]
<FromGitter>
<j8r> @bajro17 you are probably not root when launching the first command, try using `sudo echo...`
hightower has joined #crystal-lang
<FromGitter>
<bajro17> I use but it dont work for me only work method described in on Bash on Ubuntu on Windows
hightower2 has quit [Ping timeout: 256 seconds]
<FromGitter>
<j8r> I've tried on my side, it only works when you are on a root terminal. `sudo` before the command does'nt work - there is a redirection
alex`` has joined #crystal-lang
never_ has quit [Ping timeout: 256 seconds]
<FromGitter>
<MrSorcus> > @MrSorcus maybe this will help you out https://github.com/crystal-lang/crystal/issues/2963 ⏎ Thanks you so much. Yes, it's working. But i'm not sure that's a good way. Anyway thanks you 😄
alex`` has quit [Ping timeout: 240 seconds]
cremes has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter>
<yxhuvud> What the heck was #5652 about?
cremes has quit [Quit: cremes]
duane has joined #crystal-lang
never has joined #crystal-lang
cremes has joined #crystal-lang
never has quit [Ping timeout: 240 seconds]
<crystal-gh>
[crystal] MakeNowJust opened pull request #5655: Fix indentation after comment inside 'when' (master...fix/crystal-format/keep-indent-in-when-comma) https://git.io/vNyAT
<FromGitter>
<bajro17> Can someone tell me what is use of Symbols
<FromGitter>
<bajro17> :test?
<livcd>
symbol is an immutable object which refers to the same object in memory if you use it
<FromGitter>
<bajro17> thank you so much :)
<RX14>
no it's not
<livcd>
is it not ?
<RX14>
@bajro17 it's basically an enum but global
<livcd>
i must be thinking Ruby
<RX14>
livcd, in ruby you could say they're immutable strings which always point to the same memory
<RX14>
but in crystal they're not
<RX14>
they're numbers
<RX14>
and they're all known at compile time
<FromGitter>
<bajro17> than it mean it just return random number?
<FromGitter>
<bajro17> I'm really confused
<RX14>
no
<RX14>
they're implemented as numbers
<RX14>
ut they're not
<RX14>
they're not equal to numbers
<RX14>
I never use symbolks
<FromGitter>
<bajro17> Than I will just skip it :D
<RX14>
99% of the time when you want a symbol you want either an enum or you're using it as a named tuple key
<FromGitter>
<bajro17> Thank you so much Sir
<RX14>
just learn how to use symbols as named tuple keys
<RX14>
and learn how to use enums
<RX14>
and you'll never have to use them
<RX14>
we should just make named tuples use tuple.key, then remove symbols
<FromGitter>
<bajro17> also I find I can put in enum green for example it must be Capital letter
<FromGitter>
<bajro17> Gree
<FromGitter>
<bajro17> Green
<RX14>
yes
<FromGitter>
<bajro17> Thank you so much for all you explain me :)
<FromGitter>
<bew> But not practical, and you won't be able to load 2 Crystal so file at the same time
<jokke>
oh
<FromGitter>
<bew> jokke don't think so
<jokke>
i see
<jokke>
too bad :/
<FromGitter>
<bew> Why do you need a global var?
<jokke>
and what if i built a .o file and a little c program which would set up the global pointer and function and provide a setter for that pointer. then link it with my crystal .o file?
<jokke>
says so in the api reference
<jokke>
In order to call WeeChat functions in the format displayed in Plugin API, the following global pointer must be declared and initialized in the function weechat_plugin_init:
<jokke>
struct t_weechat_plugin *weechat_plugin;
<FromGitter>
<bew> Oh yes, you'll need a little C file for that i think
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
cremes has quit [Quit: cremes]
flaviodesousa has quit [Ping timeout: 265 seconds]
<FromGitter>
<codenoid> nice @watzon
<FromGitter>
<codenoid> and, morning !
<FromGitter>
<codenoid> I always hear Proleter and Caravan Palace song when coding with crystal
test has joined #crystal-lang
test has quit [Client Quit]
cremes has joined #crystal-lang
<FromGitter>
<jwoertink> Hey, is there anyone here that's created a crystal package installable through homebrew?
<FromGitter>
<jwoertink> I have one that always fails, and I don't really understand the homebrew formulas to know what I'm doing wrong
alex`` has quit [Quit: WeeChat 1.9]
<FromGitter>
<jwoertink> I'm curious if you would just build the package, and then have homebrew install that built binary, or have homebrew actually run `make`, etc...
<FromGitter>
<bmulvihill> myst-lang has a home-brew-tap
<FromGitter>
<bajro17> I recorde some tutorials on yt for crystal lang and I want use this after lesson for arrays to make little game using just arrays and gets and puts
<FromGitter>
<bajro17> at same time I learn more about crystal when I stack and ask here :)
<FromGitter>
<codenoid> where's the link @bajro17
<FromGitter>
<bajro17> I just start and my english is so bad :D
<FromGitter>
<codenoid> just joined at 27 Jan ?, wow, good luck 👍
DTZUZU has joined #crystal-lang
<FromGitter>
<bajro17> I create this channel mostly for crystal lang because I fall in love with this language and its hard to find good tutorial on internet than I will try combine all what I can find in documentation and answers from awesome people hear and make some good tutorial
<FromGitter>
<bew> @bajro17 you can also do: `"1,2,3,4".split(',', &.to_i)` less allocations :)
<FromGitter>
<bajro17> thanks @bew I will do it than like this :)
<FromGitter>
<bajro17> also how to create array of 35 unique numbers from 1 to 50?
<RX14>
Array.new(35) { rand(1..50) }
<RX14>
rip debot 2017 jhass
<FromGitter>
<imonmyown> @RX14 are you sure they will be unique?
<RX14>
no
<FromGitter>
<codenoid> the irc bot ?
<RX14>
yeah
<RX14>
@imonmyown yeah I missed that part of the requirement
<RX14>
the uniqueness is a pain
<FromGitter>
<imonmyown> > puts "Hello"
<RX14>
it was always >>
<FromGitter>
<imonmyown> \>> puts "Hello"
<FromGitter>
<imonmyown> crap
<RX14>
but its offline
<RX14>
it's gone
<RX14>
it has 0% chance of working
<RX14>
@bajro17 why do the numbers need to be unique
<RX14>
?
<FromGitter>
<imonmyown> why not just take consecutives from 1 to 50
<RX14>
??
<FromGitter>
<imonmyown> *1 to 35*
<RX14>
because thats not what was asked for?
<FromGitter>
<bajro17> I need it for this little game tutorial to make bingo
<FromGitter>
<imonmyown> well technically it fits the requirements
<RX14>
@bajro17 then you'll need an iterative solution
<FromGitter>
<bajro17> it display 35 unique numbers in range 1..49
snsei has quit [Remote host closed the connection]
<oprypin>
stuff like `(1..10..2).index(5)` is nice
snsei has joined #crystal-lang
<oprypin>
in O(1) ofc
snsei has quit [Remote host closed the connection]
andrewzah has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<RX14>
if you complicate the definition of range you basically make it so only integers can be in ranges
<oprypin>
yes
snsei has joined #crystal-lang
<RX14>
so no
<RX14>
thats a bad idea
<RX14>
you've answered it yourself
<oprypin>
what other useful ranges are there?
andrewzah has quit [Client Quit]
<RX14>
i don't know
<oprypin>
uh ok
<oprypin>
you've answered it yourself
snsei has quit [Ping timeout: 240 seconds]
cremes has quit [Quit: cremes]
<FromGitter>
<j8r> I don't know if ranges floats is useful
qard has joined #crystal-lang
cremes has joined #crystal-lang
qard has quit [Client Quit]
<FromGitter>
<ShriekBob> How would you range floats though?
<FromGitter>
<ShriekBob> I mean, you could, but you'd need a step size
<FromGitter>
<ShriekBob> otherwise theres no meaningful way to do it
<FromGitter>
<ShriekBob> Man, I made a suggestion for a change to the spec output, and now I'm like "maybe i hsould submit a PR"
<FromGitter>
<ShriekBob> but I can't make head nor tail of the spec implementation. I've found where the spec description is ouput, but damned if I can find where it's set
<FromGitter>
<ShriekBob> Sure, I'm reading that atm, but fail.description seems to contain the bulk of the text
<FromGitter>
<ShriekBob> and I'm not sure where that is being set
<RX14>
no
<RX14>
fail.description is the "foo does something with 3 and 4" bit
<FromGitter>
<ShriekBob> Ohhh
<RX14>
yeah it confused me a bit
<FromGitter>
<ShriekBob> I assume it must also set "in spec: "
<RX14>
since I wasn't looking correctly at the current spec output
<FromGitter>
<ShriekBob> because the previous thing on that line just seems to generate n)
<RX14>
which has no in spec:
<FromGitter>
<ShriekBob> Ohhh
<RX14>
look at a current spec output
<RX14>
in spec isn't there
<FromGitter>
<ShriekBob> Lesson 1: Confirm the format is still the same
<RX14>
well
<RX14>
I made the same mistake
<RX14>
so don't feel too bad about it lol
<FromGitter>
<ShriekBob> Seems like a relatively small change that I can submit a PR for, and even if it never get's merged, helps me work my way around :)