<livcd>
just read ary's happy new year...things about the type system being broken and macros are a bit concerning
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter>
<HCLarsen> The other day, someone showed me how to get a list of the methods available for an object, but I forgot. Does anyone here know how?
<FromGitter>
<HCLarsen> Or better yet, is there a way to check if a Crystal object has one specific method?
<FromGitter>
<marin117> method to_json is not working with Time::Span object
<FromGitter>
<marin117> anyone knows why?
<FromGitter>
<marin117> error : no overload matches 'Time::Span#to_json' with type JSON::Builder
lop has joined #crystal-lang
lachlan has quit [Remote host closed the connection]
lachlan has joined #crystal-lang
lop has quit [Quit: Leaving]
<FromGitter>
<straight-shoota> @marin117 There is just no converter defined for `Time::Span`
<FromGitter>
<marin117> like I thought :(
<FromGitter>
<marin117> what would be the best practice
<FromGitter>
<marin117> convert to string
<FromGitter>
<marin117> or keep seconds in json and then explicitly convert it to time::span
<FromGitter>
<straight-shoota> Depends... what do you need it for
<FromGitter>
<marin117> sending to and from server
<FromGitter>
<marin117> and write it in database on server
<FromGitter>
<straight-shoota> What format does the server expect? Or do you control the protocol on both ends?
<FromGitter>
<marin117> I control it
<FromGitter>
<marin117> in my opinion i should send seconds to server, but receive string from it (cause it is two different data)
<FromGitter>
<marin117> but I am a little bit unsure about that
<FromGitter>
<straight-shoota> Then for the time being it would probably be the easiest workaround to convert the span to integer seconds
<FromGitter>
<marin117> :)
<FromGitter>
<marin117> thank you for your help :)
<FromGitter>
<straight-shoota> you can use a converter for this in JSON.mapping
rohitpaulk has quit [Ping timeout: 248 seconds]
lachlan has quit [Remote host closed the connection]
<dragonkh>
hi - I have a class ActiveUser what would the to_json method look like - in order for the containing object to call it and it produce json instead of - no overload matches ActiveUser#to_json with type JSON::Builder
<dragonkh>
aha I added: JSON.mapping(groupId: String, channelId: String) and it worked
<FromGitter>
<straight-shoota> yes, that's how it works
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
hightower3 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
hightower2 has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter>
<asterite> livcd: I should probably clarify my email, when I say it's broken I mean that is has many bugs, but it's nothing that can't eventually be fixed (or rethought without introducing many breaking changes)
<RX14>
yeah, I don't think the feel of the type system has to be changed
<RX14>
just the edge cases
<RX14>
similarly to making type restrictions cast their arguments properly
<RX14>
IMHO that will solve compile times, but really probably won't affect many methods
<RX14>
unfortunately, there's not enough people who are confident enough with the crystal compiler to perform what I assume would be a major change in casting to type restrictions
jnyw has quit [Quit: WeeChat 2.0.1]
<livcd>
sadly :(
<FromGitter>
<asterite> I tried once but did it quickly and it had a few bugs and got tired at the moment. I also found out that we'd need to change how `a.b = c`works. That should return c, not what the `b=
<FromGitter>
<asterite> ` method returns... The method might return a more general type because of that casting
<FromGitter>
<asterite> In fact Ruby does this, it ignores that method return type
<FromGitter>
<asterite> I also tried to implement that quickly but it had bugs so I got tired. It's all a matter of effort and time
<RX14>
@asterite yeah i've been trying to make all my assign methods return c, but I thought about proposing that the compiler ignored the return type but never got around to it
<FromGitter>
<sdogruyol> @dragonkh I'll cut a release today 👍
<RX14>
@asterite not knowing the compiler very well - isn't there just one place where assigns are converted to method calls? Couldn't you just insert an Expressions with the method call and then a var reference to the result of the rhs?
<RX14>
conceptually to me it sounds simple and i'm not sure what bugs could be introduced
<RX14>
of course the reality of the compiler is different
ashirase has quit [Ping timeout: 260 seconds]
ashirase has joined #crystal-lang
<FromGitter>
<asterite> Yes, I guess we could do that as a first step. I'd like to try avoiding expanding stuff to more stuff because it means more things to type and compile, so slower compile times. But we could do it and have specs for it, later redoing it should be easier
<RX14>
yeah
<RX14>
don't let perfect be the enemy of good @asterite
<RX14>
plus if all of this is pre-work to decrease the core *amount* of typing that the compiler has to do in the first place, it seems more than worth it to me
<FromGitter>
<asterite> it's not about that. if you have a property `bar` that's Int32? and you do x = foo.bar = 1, then x ends up being Int32 right now. But if we introduce casting in type restrictions, it becomes Int32?, so it breaks code
<FromGitter>
<asterite> maybe it's just a minor thing, but it can be annoying
<RX14>
I think the current behaviour is incorrect
<RX14>
and worth breaking
<RX14>
x should be of type Int32
<RX14>
it's what you'd guess by inspection
<RX14>
if you didn't know how the compiler worked
rohitpaulk has joined #crystal-lang
<FromGitter>
<asterite> Mmm... what do you mean? x is of type Int32 right now
<RX14>
not if, for example:
<RX14>
def bar=(x) : Nil; @bar = x; end
<RX14>
the point is it's possible for the added foo.bar to affect the type of x
rohitpaulk has quit [Ping timeout: 240 seconds]
<RX14>
and that's not good
<RX14>
there's plenty of setters in the stdlib right now that don't return their RHS
<RX14>
stuff like io.blocking = true
<RX14>
and io.close_on_exec=
<RX14>
and that's clearly wrong
<RX14>
well at least those two did before I refactored them for Crystal::System
<RX14>
I might have fixed it can't remember
<FromGitter>
<asterite> ah, yes, I understand now
<RX14>
so it's worth fixing, and making an issue about, regardless of how it affects casting in type restrictions
<FromGitter>
<asterite> not at all, I was planning on reviewing all prs and check which ones are easy to approve
<RX14>
"all PRs"
<RX14>
good luck...
<RX14>
the most concerning thing about windows to me is that there's definitely a codegen/abi bug present on windows only
<RX14>
and i'm not feeling that that's going to be fun to figure out...
<FromGitter>
<asterite> hahaha, well, at least the recent ones :)
<FromGitter>
<asterite> i have a windows machine so once I have it set up to compile crystal I could try to help. By now I'm used to seeing random errors, segfaults, crashes, etc.
<RX14>
oh you're talking about terminal escapes now
<RX14>
you want print "a\r" puts "b"
<RX14>
the print "foo\r" will print "foo" and reset the cursor to the beginning of the line
<RX14>
you can't do this with multi-line strings
rohitpaulk has joined #crystal-lang
<RX14>
actually the easiest way is to always use print "\r#{message}" then when you want to stop modifying your previous line just use puts with no argument
<crystal-gh>
[crystal] RX14 closed pull request #5423: Makefile: allow passing through LDFLAGS to final link phase (master...master) https://git.io/vby1B
<FromGitter>
<bararchy> Once a year on Christmas eve @asterite comes to play, he merges all the PRs then and makes it quite a day, the Travis elf works extra hard to check then all the code, and every one is having fun PRing across the world :)
<FromGitter>
<codenoid> thank @RX14, only for one line, (y)
<FromGitter>
<drujensen> Good morning. Did we remove `to_json()` from NamedTuple? Looks like you have to provide an Json::Builder now?
<crystal-gh>
[crystal] RX14 closed pull request #5233: Change URI#to_s to handle default ports for more schemes than http/https (master...uri_default_port) https://git.io/vFsug
<dragonkh>
can I make a generic method? like def something[T](value : T) - and then call it like: something(String)("hello"). ?? I can't get it to work
<jhass>
dragonkh: yes, def something(value : T) forall T is the current syntax iirc
<jhass>
no specifying it explicitly on the callside though
snsei has quit [Ping timeout: 246 seconds]
<dragonkh>
ah great thanks - working :)
<jhass>
dragonkh: note that unless you use T in the method body it's quite equivalent to just specifying no type at all
<dragonkh>
ok I will try that too
<FromGitter>
<Yive> Is there a documentation page on dealing with error raising? Like as in how to make the program not crash when say Cossack raises the timeout error
<dragonkh>
how can I do a result.is_a?(klass) where klass is passed in - e.g. klass = String
<dragonkh>
it says: expecting token 'CONST', not 'klass'
<RX14>
dragonkh, you need to use generics for that
<dragonkh>
ah never mind
<dragonkh>
found it
<dragonkh>
I was passing T - I just needed to use it
<RX14>
and use the constant you defined using forall CONST
<RX14>
yup
<dragonkh>
if I have a variable in scope e.g. get "/main" do |context| go(context) end. <--- is there a way to have the go method implicitly use the context without having to pass it in?
Poeticode has quit [Quit: Feels good to be a gangster.]
Poeticode has joined #crystal-lang
Poeticode has quit [Changing host]
Poeticode has joined #crystal-lang
vivus has joined #crystal-lang
alex1 has joined #crystal-lang
alex1 has quit [Client Quit]
alex``` has joined #crystal-lang
alex``` has quit [Client Quit]
alex``` has joined #crystal-lang
ua_ has quit [Ping timeout: 264 seconds]
ua_ has joined #crystal-lang
ua_ has quit [Client Quit]
ua has joined #crystal-lang
cremes has quit [Quit: cremes]
alex``` has quit [Quit: WeeChat 1.9]
<FromGitter>
<bew> What is the `release/0.24` branch for?
<RX14>
0.24.2
<RX14>
which is basically 0.24.1 + bugfixes only
<FromGitter>
<bew> ah ok, and master would be 0.25 when it's time?
<RX14>
supposedly
<FromGitter>
<straight-shoota> Wow this year is taking off like a blast
<FromGitter>
<straight-shoota> I've been out all day and it's over two pages of updated GitHub issues
<FromGitter>
<sdogruyol> thanks for @asterite 👍
<FromGitter>
<straight-shoota> And ~30 closed (probably merged) PRs since last year
jnyw has joined #crystal-lang
faustinoaq has joined #crystal-lang
<FromGitter>
<straight-shoota> Really amazing what effect an additional active core member has ;(
<FromGitter>
<straight-shoota> ;)
<FromGitter>
<bararchy> Now we just need @waj back for a week to finish Multi-Thread support, and RX14 will finish Windows and we can announce 1.0 ;)
<RX14>
...
<FromGitter>
<bararchy> Hahahha
<FromGitter>
<straight-shoota> I mean actively working on the issue queue, reviewing contributions etc.
<oprypin>
i think that at this point issue queue is less important than thread support
<FromGitter>
<bararchy> If it issue queue or nothing I'll take the first :/
<FromGitter>
<bararchy> Sadly
<oprypin>
yeah and it's happening
<oprypin>
which is nice
<RX14>
@straight-shoota yeah it's amazing what doubling the number of active more members does...
<oprypin>
:p
<FromGitter>
<bararchy> Just add oprypin to core devs
<FromGitter>
<bararchy> :)
<oprypin>
i mean... i should up my activity before that happens
<FromGitter>
<bararchy> Ah... You're more active then other core devs
<FromGitter>
<bararchy> So...
<RX14>
oprypin knows the language, he hasn't read every comment on every issue in the last 2 years though
<FromGitter>
<bararchy> Oh, and who did? @asterite ?
<RX14>
asterite's been doing it for longer than 2 years
<FromGitter>
<straight-shoota> is that a formal requirement to become core member?
<RX14>
no
<RX14>
the point being: you really need to be active on the issue tracker to be a core developer
<oprypin>
there are no formal requirements, only informal ones if i understand
<FromGitter>
<straight-shoota> yeah, I was joking
<RX14>
that means watching the repository and responding to issues
<FromGitter>
<bararchy> If so then I guess @sdogruyol should be Core member
<oprypin>
but he's not doing that stuff either
<RX14>
not sure @sdogruyol reads all the issues...
<FromGitter>
<bararchy> I think he does, he sure is sending me links to interesting ones all the time :)
<RX14>
active != lurking though :P
<FromGitter>
<bararchy> What about Jhass?
<FromGitter>
<bararchy> Or yasbaden (can't spell he's nick)
<oprypin>
they are both in
<FromGitter>
<bararchy> Oh
<FromGitter>
<bararchy> So 4 core devs ?
<FromGitter>
<straight-shoota> @bararchy you get a personal stream of recommended issues? :D
<dragonkh>
I've just started building my next epic project in Crystal - great work on the language so far :) hopefully by the time I release it - people will change from asking me - what is Crystal, why are you building it in Crystal - to cool project dude - nice choice of language ;)
<FromGitter>
<straight-shoota> plus incognito core members like asterite
<FromGitter>
<straight-shoota> not everyone really active on github though
<FromGitter>
<bararchy> @straight-shoota all via the @sdogruyol express news
<FromGitter>
<straight-shoota> nice ;)
<RX14>
that is all oprypin
<FromGitter>
<bararchy> What about Papierkorb ?
<FromGitter>
<bararchy> He is pretty active + helps in issues
<oprypin>
i dunno, probably not quite there either, but close
<RX14>
iirc Papierkorb doesn't follow either
<RX14>
@straight-shoota you're more active than Papierkorb on the issue tracker
<RX14>
I don't think we need more people though
<RX14>
we need more people to be active
<FromGitter>
<straight-shoota> yeah I've been following quite actively for the last months
<FromGitter>
<bararchy> @straight-shoota yeha, I see you review and answer all the time
<FromGitter>
<straight-shoota> I try to do my best. And it helps to follow many issues so you get a broad view of whats going on and connect things
<FromGitter>
<straight-shoota> takes a lot of time but it's mostly fun and I learn a lot
<FromGitter>
<straight-shoota> still don't know much about the inner workings of the language and only basics of C stuff. So I wouldn't recommend myself as a core member.
<FromGitter>
<bew> that's for sure! for myself I'm watching since... a long time, but I try to unsubscribe for issues/prs when I know I won't be of any help, or it's not interesting
<FromGitter>
<bew> I think I would love to be a core member, but I also think I'm not ready now..
<FromGitter>
<straight-shoota> yep
<FromGitter>
<bew> the "that's for sure" was for "I learn a lot" (just to clarify) ^^
<FromGitter>
<straight-shoota> I figured as much :P
<oprypin>
i don't even know what i'm doing anymore. not handling my free time well, that's for sure.
jokke has quit [Ping timeout: 264 seconds]
jokke has joined #crystal-lang
<RX14>
it's hard to find someone i'd consider as a good core team member
<oprypin>
:|
<RX14>
you need to find someone who is opinionated, passionate, has a large breadth of general practical programming knowledge, has time to follow the issue tracker, and is well-versed in the internals of crystal's stdlib and the compiler
<oprypin>
just need a lot of free time and i got it
<RX14>
yeah pretty much oprypin
<RX14>
i probably shouldn't say but thats my assesment of you and Papierkorb for the core team: if only you had the free time and will to follow and be much more active on the issue tracker
greengriminal has joined #crystal-lang
<FromGitter>
<paulcsmith> I think community skills are important as well. Making people feel welcome and encouraging new opinions and contributions
<FromGitter>
<paulcsmith> The core team has a huge effect on the community as a whole
<FromGitter>
<straight-shoota> it does
<FromGitter>
<straight-shoota> but also non-core members can get pretty far in helping with community management
alex``` has joined #crystal-lang
<RX14>
that's the part i'm worst about @paulcsmith
<RX14>
i'll admit
rohitpaulk has joined #crystal-lang
<RX14>
@straight-shoota updated my feature/windows-spec to be rebased on master
<FromGitter>
<paulcsmith> @straight-shoota Definitely. You and others outside the core team have been really helpful here an in the Crystal repo :D
<RX14>
@straight-shoota i cheated, git reset --hard onto your rebased Crystal::Ssytem::Time PR and then cherry-pciked the relevant commits
<FromGitter>
<straight-shoota> RX14, great! I didn't get it to run completely yet because of some lib issues. But I'll give it another go
<RX14>
I can help you with compiling the libs
<RX14>
what issues?
<FromGitter>
<straight-shoota> whatever gets the job done...
<FromGitter>
<straight-shoota> can't tell right now
<FromGitter>
<paulcsmith> @RX14 I'm grateful for your work and I've noticed you are doing an awesome job at teaching others and helping with newcomers. So don't be hard on yourself :) I've definitely noticed a lot of improvement
<FromGitter>
<straight-shoota> linker complained about something not matching up
<RX14>
with pcre?
<RX14>
yeah that happens if you follow TXE's instructions exactly
<RX14>
because i went through that journey of discovery myself lol
<FromGitter>
<straight-shoota> hehe
<RX14>
i have no idea why it emits ELF without pc
<RX14>
it's stupid
<FromGitter>
<straight-shoota> Now the linker gives this error: ⏎ `gc.lib(misc.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxA referenced in function GC_win32_MessageBoxA ⏎ spec_test.exe : fatal error LNK1120: 1 unresolved externals`
<FromGitter>
<bew> what is `pc` in this case?
<RX14>
@bew the vendor
<RX14>
machine-vendor-os
<RX14>
where os can be two fields
<FromGitter>
<bew> and what is `vendor`?
<RX14>
so x86_64-linux-gnu is actually: machine: x86_64, vendor: unknown/undefined, os: linux-gnu
<RX14>
@bew well pc is just personal computer
<FromGitter>
<bew> ah x) what else could it be?
<RX14>
the target triple stuff needs to actually go
<RX14>
we need to abstract over it
<RX14>
we need to have a simple list of "os", "architecture" and additional flags such as fpu on arm