<FromGitter>
<bew> I'm not sure I understand, from what I see the each_use method will block the fiber and call the block indefinitely with the last cpu (which one?) used percentage
<FromGitter>
<bew> But it will not return
<FromGitter>
<asterite> Literal regex is compiled and stored in a constant, so more efficient than Regex.new. It's a secret only I know, bwa ha ha
<FromGitter>
<bew> (so the doc doesn't seems to match what it actually do)
<FromGitter>
<bew> Ahah @asterite I was wondering about that possibility, but never actually asked :P nice!!
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
__mwalsh__ has joined #crystal-lang
Yxhuvud has joined #crystal-lang
__mwalsh__ has quit [Client Quit]
__marty__ has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
__marty__ has quit []
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
__marty__ has joined #crystal-lang
__marty__ has left #crystal-lang [#crystal-lang]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Nathanaelle has joined #crystal-lang
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Client Quit]
greengriminal has joined #crystal-lang
Yxhuvud has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 240 seconds]
qard has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
Nathanaelle has joined #crystal-lang
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
hgost has quit [Quit: Lost terminal]
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter>
<girng> 8:43 pm here, hello
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
<FromGitter>
<kimvex> Hi
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
<FromGitter>
<kimvex> Does anyone know how to get the path of the file from the code? something like example js ⏎ ⏎ `console.log(__dirname)`
<FromGitter>
<kimvex> is displayed with Process.exec ("pwd")
<FromGitter>
<kimvex> Is it a good practice to do that?
<FromGitter>
<bew> No
<FromGitter>
<bew> Just do `Dir.current`
<FromGitter>
<bew> This will get the current working directory
<FromGitter>
<bew> There is also `__DIR__` for the directory where the current source file is
<FromGitter>
<kimvex> ooh thank you very much
alex`` has joined #crystal-lang
sagax has joined #crystal-lang
__marty__ has joined #crystal-lang
<Majost>
Does anyone have an example of PrettyPrint?
<Majost>
Seems to be different enough from the ruby version that I am not getting it right
<Majost>
heh
<FromGitter>
<bew> `pp some_things`
<FromGitter>
<girng> don't get me started on `p`
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 256 seconds]
Nathanaelle has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
qard has quit [Remote host closed the connection]
qard has joined #crystal-lang
DTZUZO has quit [Ping timeout: 260 seconds]
__marty__ has quit [Remote host closed the connection]
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
ua_ has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
txdv has quit [Ping timeout: 255 seconds]
alex`` has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Ping timeout: 264 seconds]
ua has quit [Ping timeout: 240 seconds]
txdv has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter>
<yxhuvud> What is wrong with p? It does what it should, for the intended purpose (debug printing)
That_Guy_Anon has quit [Ping timeout: 240 seconds]
rumenzu has joined #crystal-lang
rumenzu has quit [Client Quit]
<crystal-gh>
[crystal] sdogruyol pushed 1 new commit to master: https://git.io/vplds
<crystal-gh>
crystal/master d3be42e Johannes Müller: Improve WebSocket handshake validation (#5327)
<FromGitter>
<straight-shoota> @sdogruyol I'll fix it.
<FromGitter>
<straight-shoota> That sort of error happens because PRs are pending for to long... =/
kurko_ has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter>
<DRVTiny> Hello4all! Have anybody succesfully create "*.so" with Crystal?
<FromGitter>
<DRVTiny> Or "did anybody create"...
<FromGitter>
<asterite> Not possible for the moment, and possibly never
<FromGitter>
<asterite> wow, I just downloaded SushiCoin to see how are compile times. It's about ~4600 lines of code, plus the same amount for specs. It takes about 1~2 seconds to compile. I don't know why I'm always worrying about compile times. I think the only slow one is the compiler, and there must be some special reason for that...
<FromGitter>
<asterite> @DRVTiny think of Crystal as like Ruby: can you create "*.so" with Ruby? No. So you can't with Crystal either
<FromGitter>
<DRVTiny> But... there is such compiler option!
greengriminal has joined #crystal-lang
<crystal-gh>
[crystal] asterite reopened pull request #6007: Don't leak variable name when assining to ivar/cvar in method signature (master...feature/no-implicit-instance-var) https://git.io/vpc87
<FromGitter>
<DRVTiny> With "*.so" creation support we can make it possible to write binary modules for interpreted languages such as perl, php, python
<FromGitter>
<DRVTiny> This is very promising usage area for crystal
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<DRVTiny> (because lower potential barrier between compiled and interpreted languages)
<FromGitter>
<DRVTiny> > With "*.so" creation support we can make it possible to write binary modules for interpreted languages such as perl, php, python ⏎ Yes, binary extensions for Ruby/MRI too :)
<txdv>
write extension with the nice ruby for the shitty ruby
<FromGitter>
<asterite> Yeah, it's not possible because every compilation is different. In every compilation every type gets a different ID, every symbol gets a different integer value, etc.
<FromGitter>
<asterite> It's simply not possible unless we start changing a loooot of things, so I wouldn't hold my hopes up for the moment
<FromGitter>
<asterite> Crystal was created to write user-facing apps, not intermediate libraries (or, well, not intermediate libraries meant to be used in languages other than Crystal). So make the best out of that single use case :-)
faustinoaq has quit [Quit: IRC client terminated!]
<FromGitter>
<DRVTiny> @asterite Thank you for reply! Ok
<FromGitter>
<asterite> @DRVTiny glad to help
<FromGitter>
<bararchy> @asterite I thogut the only reason .so libs are not supported is that you can't disable GC, which means .so lib will GC its own memory while it should not
<FromGitter>
<bararchy> Basically compile without main means .so lib
<FromGitter>
<asterite> That's *another* reason why it can't be done :-)
<FromGitter>
<asterite> Ah, I see. Well, it could work, I don't know. It's definitely not something "out of the box" and the repo has "proof of concept" in it and "hack" a couple of times :-D
<FromGitter>
<DRVTiny> HEREDOC excelently works in macroses. Wow! Thank you, developers, its really amazing!
<FromGitter>
<bararchy> @asterite yeha I wouldn't actually use this for prod or something, but it could be done, I would argue that we need to take steps to mainline this ability but its not really high priority
kurko_ has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter>
<girng> what is sushicoin, is it like enjin coin?
<FromGitter>
<alehander42> what a great name :D
<FromGitter>
<yxhuvud> @asterite would it be possible to make a solution where all exported functions to an SO is explicitly declared, ie like how we bind to c functions but backwards? Would that be simpler?
<FromGitter>
<j8r> Apparently Go can do it, but have a GC - why?
<RX14>
why not just make a recursive method, then refer to it as a closure
<FromGitter>
<bew> Shared libraries are possible and work (I did a mpv plugin once!) but iirc you can't use 2 crystal .so at the same time, as some things will conflict
<RX14>
the crystal compiler can do shared libraries with some hacking
<RX14>
the crystal stdlib cannot
<FromGitter>
<bew> Ya
<RX14>
and the effort to make that happen would come far down the line if ever
<FromGitter>
<sherjilozair> @RX14 in principle, is it not possible to infer the type? Would that lead to problems elsewhere? Is the algorithm really hard?
<RX14>
but you don't want to infer the type
<RX14>
because you might not *mean* for f to be Int32
<RX14>
if you do mean for foo to be Int32 then you can be explicit about that
<RX14>
you get a compile error either way
<FromGitter>
<girng> @sherjilozair crystal is a statically typed i belive, it's always best to be explicit i think
<RX14>
if it was always best to be explicit we wouldn't allow you to not specify type args
<RX14>
also gitter bot died
<RX14>
rip in peperonis
<RX14>
@DRVTiny pass them in as args...
<FromGitter>
<sherjilozair> But why be explicit when it's possible to infer. I don't get it.
<FromGitter>
<DRVTiny> recurse_get fills data structures that exists only inside the get_tree_branch. How can private method knows about that structures??
<RX14>
there we go gitter bot's back
<FromGitter>
<girng> what does gitter bot do? irc bridge bot u mean? i can still ur messages
<FromGitter>
<DRVTiny> Hmm. Why to use the stack if i can avoid this?
<RX14>
@sherjilozair if you pass a string into f, it's better that crystal tells you that g doesn't accept strings than telling you that f doesn't accept strings
<FromGitter>
<sherjilozair> @RX14 Why is it better to be explicit? I thought the whole point of Crystal was that it's smart enough to figure out what I want.
<FromGitter>
<sherjilozair> Okay, let me think about this.
<RX14>
if you tell the user that f doesn't accept strings you're assuming that the person who wrote function f *meant* to call g
<RX14>
and that's not always true
<RX14>
best to show more information
<RX14>
and as I explained, either way you get the same error
<RX14>
and @sherjilozair I didn't say that you should be more explicit
<RX14>
i said exactly the opposite
<FromGitter>
<sherjilozair> oh okay
<RX14>
<RX14> if it was always best to be explicit we wouldn't allow you to not specify type args
<FromGitter>
<girng> well, what i do is sherjilozair, is i think of crystal as a statically typed language (it really is I think), and then use I union types whenever my nasty dynamic language ways are haunting me
<RX14>
well it is a statically typed language
<RX14>
and no unnions don't make it dynamic
<RX14>
it just adds more power to your static types
<FromGitter>
<girng> how is it a static type if it has a union
<FromGitter>
<girng> tjhat means it has multiple types
<RX14>
no, it has one type
<RX14>
the union of both
<FromGitter>
<girng> well, the types are separated by |'s
<RX14>
unions ARE types
<FromGitter>
<girng> i have tons of em
<FromGitter>
<sherjilozair> I'm still not convinced by your example. We could tell the user that "f does not accept strings, because g does not accept string, because and so on". That is, we could actually show the type inference logic why a particular user-defined function cannot take a certain type.
<FromGitter>
<girng> yes, the union types assigned to the variable
<RX14>
@sherjilozair the crystal type inference doesn't work like that
<RX14>
we never grow types out of methods
<RX14>
we always grow types from literals
<RX14>
the type arguments to methods are always checks
<RX14>
they never tell the compiler anything
<RX14>
except when to throw an error
<FromGitter>
<sherjilozair> @RX14 Sure. That's how the current system works. I'm asking whether there's any problem with growing types out of function types.
<FromGitter>
<sherjilozair> Could, say, Crystal 2.0 support types grown out of function types.
<FromGitter>
<girng> 1) 0 LOL
<FromGitter>
<sherjilozair> Would it make the language inconsistent or something?
<RX14>
@sherjilozair i don't know
<FromGitter>
<bew> Time will tell
<RX14>
but I do know it's not going to happen any time soon
<FromGitter>
<sherjilozair> @bew You misunderstand. I'm not asking whether the devs would want that.
<FromGitter>
<sherjilozair> I'm asking if it's technically possible.
<RX14>
and the answer is I havent thought about it
<RX14>
i'm not sure what it'd gain you though
<FromGitter>
<sherjilozair> @RX14 would make crystal be closer to dynamic typing? fewer types to specify, etc.
<RX14>
in crystal you know the types of the arguments of the function always before you type the body
<FromGitter>
<sherjilozair> more like ruby and python.
<RX14>
no?
<RX14>
where do you have to specify types in the first place?
<FromGitter>
<girng> in a union
<FromGitter>
<sherjilozair> the point is just laziness. I know the types, but I don't want to type it.
<FromGitter>
<girng> use a union
<FromGitter>
<sherjilozair> esp when I'm using the variable in a function which makes it completely unambiguous what the type is.
<FromGitter>
<girng> alias
<RX14>
@girng you don't have to specify types of unions
<FromGitter>
<sherjilozair> union's still a type.
<FromGitter>
<girng> it ACCEPTS multiple types
<RX14>
they just happen
<RX14>
because of flow typing
<FromGitter>
<DRVTiny> Arrrgh. I cant call fng closure recursively because i must assign the variable something before read it :(
<FromGitter>
<girng> to a variable, which is a solution to your "lazyness"
<RX14>
@sherjilozair I'm not sure it'd get you any kind of extra power at all
<RX14>
crystal used to be able to infer the types of generics classes from just their usages
<RX14>
we removed it because it destroyed compilation speed
<RX14>
crystal used to be able to infer the types of ivars
<RX14>
we removed it because it destroyed compilation speed
<FromGitter>
<DRVTiny> Again, can i (in theory) call any closure recursively in Crystal? ^)
<RX14>
i told you
<FromGitter>
<yxhuvud> Sigh. I so wish ruby adopted the &. syntax for block methods.
<FromGitter>
<DRVTiny> Heh, i finally CAN call closure recursively, so i can avoid stupid OOP patterns here. ⏎ Uhhu!!!
<RX14>
@DRVTiny how
<FromGitter>
<DRVTiny> Declare empty prototype for function
<RX14>
yes
<FromGitter>
<asterite> RX14: actually, we added explicit types so we could eventually compile it incrementally or modularly. I'm not sure it affected compile times, probably yes. But now that I'm not sure about improving compile time speed, maybe we can just let the compiler infer everything from usage :-P
<RX14>
but it's just easier to write a private function
<RX14>
@asterite at least the generic args speeded stuff up
<FromGitter>
<asterite> Hm, actually, the other reason was better error messages. Having something being inferred to some types and not understanding why was a big problem
<FromGitter>
<DRVTiny> First, i declare empty proto ant then create function that do what i need and calls itself recursively
<FromGitter>
<asterite> Ah, yes, without generic args it was exponentially slow
<RX14>
I ended up liking typed ivars @asterite
<FromGitter>
<girng> he wants a more "dynamic type" his parameter (`foo`). If he's using this, he doesn't have to worry about explicitness stuff. he the union will take care of it for him. that's what i got out of it anyway
<RX14>
even though i was on the other side
<FromGitter>
<asterite> I think me too. It's give a solid anchor in all the untyped sea
<FromGitter>
<sherjilozair> @asterite What do you think about inferring types from function types?
<RX14>
@girng no, @sherjilozair is asking about the compiler internals
<RX14>
nothing to do with expressability
<FromGitter>
<asterite> @sherjilozair what do you mean?
<FromGitter>
<yxhuvud> yeah it is nice to type the structures, whereas the nitty gritty details about method arguments are often uninteresting
<FromGitter>
<girng> because now he can do foo : MyCustomType (that he created from the alias)
<FromGitter>
<asterite> Ah, no, function types are generics, so we can't infer types there
<RX14>
well yeah thats one hurdle
<FromGitter>
<sherjilozair> @asterite If I have a variable which is being used as an input to a method whose signature is known, then Crystal should be able to figure out the variable's type, but right now, it doesn't.
<FromGitter>
<sherjilozair> @asterite This struck me as odd. I thought Crystal wanted to minimize the number of types the programmer has to add.
<RX14>
@sherjilozair but crystal can already figure out the variable's type from where it was assigned
<FromGitter>
<girng> omg
<RX14>
so what does it gain you
<RX14>
I'm asking around the motivation for the question
<FromGitter>
<asterite> @sherjilozair what's an example? I can't understand without code
<RX14>
because I see no example where what you're proposing adds expresiveness @sherjilozair
<FromGitter>
<DRVTiny> > but crystal can already figure out the variable's type from where it was assigned ⏎ Why it infere type of var "x" in x = 1 as Int32, but not UInt8? :)
<RX14>
but you're right, that exact example used to work
<RX14>
we didn't infer the type of @x from the Math.cos though
<RX14>
we always infered the type of `@x` from the type of `2`
rumenzu has quit []
<RX14>
how it was inferred doesn't matter
<FromGitter>
<sherjilozair> Right. Now it doesn't infer from the literal or the function signature.
<RX14>
we removed type inference for ivars because it leads to confusing code#
<FromGitter>
<girng> crystal is a statically typed language............. why try to make "automatically" infer types?!
<FromGitter>
<girng> must explicitly define types...
<FromGitter>
<sherjilozair> @girng to me that's the whole point of crystal.
<RX14>
@girng it does already automatically infer types lol
<FromGitter>
<sherjilozair> Static power but dynamic-seeming syntax.
<RX14>
being explicit about your ivar types is such a small burden
<RX14>
and it makes errors a lot better
<FromGitter>
<sherjilozair> @RX14 It is. But it's still annoying.
<FromGitter>
<asterite> bew: I have a conflict implement meta attribute. The attributes can be used inside methods, but not outside them because instance vars are not yet defined them. So this is another confusing thing about the language, I don't know if it'll be okay, maybe yes. But I didn't start implementing anything yet
<RX14>
@sherjilozair it's less annoying than debugging the messes it makes
<RX14>
trust me
<RX14>
I used crystal when it did work
That_Guy_Anon has joined #crystal-lang
<FromGitter>
<asterite> @sherjilozair sorry, that's not how it works. Crystal won't infer instance vars from (complex) usage
<FromGitter>
<girng> @sherjilozair i feel you, that's why i like the union stuff. because i am lazy.
<FromGitter>
<asterite> how hard is it to type `@x : Float64?`?
<FromGitter>
<sherjilozair> @asterite That's a very weird counter-argument. How hard is it to use a statically-typed language? Why am I not just using C# or C++ or C?
<FromGitter>
<asterite> Why you are not using Ruby, where you don't need to type anything?
<RX14>
@sherjilozair, because the frequency of types is reduced from one every 5 lines of code to maybe 1 every 500
<FromGitter>
<sherjilozair> I primarily do use Python for my work. I started looking into Crystal because I was hooked by the advertisements.
<FromGitter>
<j8r> I dunno maybe I'm saying something idiot, but what about a type inferer that adds the types directly in the code. Once added, no more performance/debbuging mess penality
<FromGitter>
<sherjilozair> @j8r Yeah, maybe an IDE could do that.
<FromGitter>
<sherjilozair> @j8r Or better, preprocessing.
<RX14>
@sherjilozair crystal is between dynamic and static typed languages
<RX14>
and I think we explained that tradeoff pretty well:
<RX14>
typing ivars gains you a lot better error messages for very little work
<FromGitter>
<sherjilozair> Is there an example you could give which demonstrates why not typing ivars is a bad idea? I can't really think why ivars are special here.
<RX14>
and the same is *not* true for method args or method bodies
<FromGitter>
<asterite> @sherjilozair you'll be surprised then to know that I (and waj) wouldn't mind having crystal be typed in even more places. To us not typing stuff was a nice experiment, that will probably go on, but we are more inclined now to type more and more stuff
<RX14>
@sherjilozair because "instantiating" a class is additive
<FromGitter>
<asterite> @sherjilozair it's easy, try to implement such language and you'll understand why it's not a good idea
<RX14>
instantiating a method is seperate
<FromGitter>
<DRVTiny> I dont know ANY statically typed language without any type inference, that produces an exception when assigning number 45 to variable declared as UInt16 ⏎ Crystal is unique language that forces me to write something strange like 45_u16
<FromGitter>
<picatz> I got hooked on types pretty fast. ✨
<FromGitter>
<sherjilozair> @asterite That is very surprising. I thought that that is Crystal's USP>
<RX14>
@asterite from the compiler authors side of course you want us to ass more types
<RX14>
from a lamguage users point of view they want types to always be optional
<FromGitter>
<asterite> @DRVTiny yes, there's an issue for that, it might be fixed one day
<FromGitter>
<yxhuvud> @DRVTiny Ada doesn't do automatic type coersions.
<RX14>
@sherjilozair to be fair @asterite
<RX14>
s view isn't shared among the userbase
<FromGitter>
<sherjilozair> @asterite As @RX14 says, maybe this is your bias as a compiler designer? I think I'd happy to lose some performance if I don't have to add types at all.
<FromGitter>
<sherjilozair> And I'd be happy to add types in if I wanted to improve performance later in the development.
<FromGitter>
<asterite> @sherjilozair you mean, you'll have happy to wait 30 minutes to compile a "hello world"?
<FromGitter>
<yxhuvud> otoh, it is pretty nice when the compiler designers are happy with their languages :P
<RX14>
@sherjilozair let me explain how ivars and normal vars are different
<FromGitter>
<sherjilozair> @asterite I'm sure that's an exaggeration.
<FromGitter>
<asterite> @sherjilozair I *know* it's not
<FromGitter>
<girng> @sherjilozair please don't be put off just by this silly infer type thing man. i am a testament at how fun and easy this language is to learn (if you see chat history logs, i don't have python or ruby background at ALL, i'm from nodejs). i'm still learning massively and converting my gameserver and crystal has been a godsend, really. it's super fast and syntaxically pleasing. ⏎ ⏎ please don't judge the
<FromGitter>
... entire potential of the language over one little issue. if I did that, i would have stopped LONG ago.but you don't know how happy I am to of stayed
<RX14>
in crystal when you call a method, it is templated out into many instantiations of the method
<RX14>
each instantiation has a specific set of types for it's arguments
<FromGitter>
<sherjilozair> @girng Don't misunderstand me. I'm loving Crystal, and I will continue to use it, and participate in the ecosystem.
<RX14>
for an instance var, you cannot template the types
<RX14>
unless your class is specifically generic
<FromGitter>
<sherjilozair> @girng As we speak, I am working on CUDA wrappers for crystal.
<FromGitter>
<picatz> @asterite @sherjilozair RX14 I love the conversation ❤️
<FromGitter>
<j8r> And type in argument adds documentation, neat!
<RX14>
because you have to have all classes have the same binary layout
<FromGitter>
<yxhuvud> TBH I didn't like declaring ivars when that change was made, but it has convinced me over time.
<RX14>
all methods don't have to have the same binary layout
<RX14>
so in ivars, some code that's entirely UNRELATED to the error trace can change the type if an ivar
<RX14>
but the same is absolutely not true for local vars and method args
<FromGitter>
<girng> @sherjilozair ok, i am sorry for misunderstanding, just the vibe i felt (it was kinda strong so i thoguht it'd be worth it to tell you)
<RX14>
and thats why we have the distinction
<FromGitter>
<DRVTiny> I mean, use it will be very good to make it possible to insert some_optional_text after "end" without a pound sign
<RX14>
@DRVTiny if you can't see what end matches to what start, then your methods are too complex
<dom96>
@DRVTiny Python?
<FromGitter>
<DRVTiny> Python not uses "end"?
<FromGitter>
<sherjilozair> @RX14 Could you elaborate on "some code that's entirely UNRELATED to the error trace can change the type if an ivar" ? Why not just consider the code which caused the type of the ivar to change as part of the message being shown to the user when there is an error.
<dom96>
indeed it doesn't
<dom96>
One of the great things about Python IMO ;)
<FromGitter>
<sherjilozair> @asterite Are you really saying that inferring ivar types made compilation take 30 minutes for a program as big as "hello world"?
<FromGitter>
<DRVTiny> Ah, yes, python uses indents! My primary language is perl, sorry
<FromGitter>
<sherjilozair> Yeah optional `end` might be another good thing for Crystal. (but I don't care about this too much)
<RX14>
there's way too many people talking about random stuff
ua_ has joined #crystal-lang
<FromGitter>
<picatz> :shipit: Crystal is pop'n
<FromGitter>
<sherjilozair> @j8r yes, adding types for documentation makes sense. However, the question is whether it should be compulsory. If I'm writing a script just to test something (common in web scraping, scientific computing), there's nothing to document here. This is the usecase I care about (rapid prototyping), and where optional types would help.
<RX14>
@sherjilozair which is *exactly* why we keep optional typing in every place where it makes sense
<RX14>
however the example I showed you shows you that the error messages for inferring ivar types are crazy
<RX14>
because @x becomes String | Int32 "by magic" based on two wildly disparate statements anywhere in your codebase
<RX14>
in methods, you just type x as String and x as Int32 seperately and compile two method instantiations
<RX14>
simple and avoids the problem
<RX14>
in ivars, thats impossible
ua has quit [Ping timeout: 240 seconds]
<FromGitter>
<girng> what'st he difference between
<FromGitter>
<girng> property variablename ⏎ and "instance variables"?
<FromGitter>
<sherjilozair> @RX14 Yeah this error is crazy.
<RX14>
the compiler can automatixcally make methods generic (in fact, every method is templated or generic)
<RX14>
it's insane to automatically make classes generic
<RX14>
because automatically making classes generic makes them not binary compatible and then you're fucked
<FromGitter>
<j8r> @girng the `property`macro generates `def`s to access/modify the ivar from the outside
<FromGitter>
<girng> if you remove the `@`, it will print Test Player
<FromGitter>
<girng> But if you use the @, it modifies the variable
<FromGitter>
<girng> instance variable**
<FromGitter>
<j8r> Also there is `def ivar=(@ivar); end` so you can modify it without the @ inside defs
<FromGitter>
<j8r> and from outside
ua_ has quit [Ping timeout: 240 seconds]
<FromGitter>
<girng> so wait, what happens when the @ isn't used
<FromGitter>
<girng> there is no error
<RX14>
i really don't like @var except inside the ctor
<RX14>
as in
<RX14>
inside args
<FromGitter>
<girng> but it compiles, but the variable doesn't change (so we know it didn't work)
<FromGitter>
<j8r> I was talking inside methods, `@var` vs (self.)`var`
<FromGitter>
<sherjilozair> @RX14 Yes, thanks. I'm slightly more convinced. However, I will think about this more. You are using the example of a bad error message to show why something is bad. But I'm not 100% convinced that it's not possible to produce better error messages. Is that what you're claiming? That better error messages are impossible without explicit types?
<RX14>
@sherjilozair i'm not claiming they're impossible
<FromGitter>
<girng> it's a short hand syntax?
<FromGitter>
<j8r> @girng no
<FromGitter>
<girng> well, it works... it modified the variable lol
<RX14>
@sherjilozair, you'd have to list every single time the type changed, and the entire backtrace of the type
<RX14>
consider that finding out why any particular variable is a particular type in crystal can generate well over 5 pages of errors
<RX14>
then multiply that by the number of times an ivar type changes
<RX14>
you're on a course for the same error messages you get with C++ templates
<FromGitter>
<girng> that means bad performance?
<RX14>
and nobody likes them
<FromGitter>
<j8r> @girng how do you access methods inside the same classes?
<FromGitter>
<girng> @j8r methods? i just type the method name out lol
<FromGitter>
<j8r> `def name; end` can be accessed by `name`, a shortcut of `self.name` (in a Class)
ua_ has joined #crystal-lang
<FromGitter>
<j8r> Why `name == @name` is becasue `def name; @name; end` generated by the macro
<FromGitter>
<girng> ok
<RX14>
@sherjilozair i'm sure you could generate a couple megabytes of error messages with only a few lines of crystal if you went the "complete error message" path
<FromGitter>
<girng> so with that said, what's the "proper" way to modify a variable in a class? `@` or `self`?
<FromGitter>
<j8r> 1) Only use macros like getter, setter and property when you need to. ⏎ 2) It's better to directly modify an instance variable (`@`) vs passing by instance methods
<FromGitter>
<j8r> IMO it's also clearer, you directly see instance variables in the code vs another method
<FromGitter>
<girng> ok thanks well im sticking with `@` then
tilpner has quit [Quit: :wq]
<FromGitter>
<girng> i am still confused
ua_ has quit [Ping timeout: 248 seconds]
<FromGitter>
<j8r> Look at the generated methods
<FromGitter>
<girng> what differentiates between a "instance variable" and just using property macro
<FromGitter>
<girng> bcz you can access the variable after creating the class, you don't need a def initialize
<FromGitter>
<girng> so where does this "instance variable" stuff come into play and what makes it different than just a regular variable (for example, `name` in my example)?
<FromGitter>
<j8r> there is `@name` under the ground
<FromGitter>
<girng> OH
<FromGitter>
<girng> so the property macro creates the "instance variable"
<FromGitter>
<girng> right?
<FromGitter>
<j8r> Also use rather `getter` vs `property`
<FromGitter>
<girng> @vlazar so, in the real world examples would there be a favor of using your `modify_player_name_via_method` over `modify_player_name_via_instance_var`. or merely personal preference?
<FromGitter>
<j8r> second one
<FromGitter>
<girng> i just feeel like there are so many ways to modify the variable, i want to know the "proper" way. and i'm leading towards just using `@` as i believe it's universal / correct and j8r recomend it too
<FromGitter>
<j8r> because `self.name` call another method that will modify the var
<FromGitter>
<j8r> 1) do you have to modify ONLY in the class or from outside?
<FromGitter>
<vlazar> @girg I tend to use instance vars in initializer and methods everywhere else just like @RX14
<FromGitter>
<vlazar> even for private
<FromGitter>
<vlazar> makes code look cleaner without all those `@`
<FromGitter>
<j8r> Maybe but don't really agree
<FromGitter>
<j8r> we can't see what's instance var vs method var directly
<FromGitter>
<vlazar> and what's more important decouples internal implementation from interface
<FromGitter>
<girng> iuno i feel like im going down a deep rabbit hole
<FromGitter>
<girng> i overthinking sorry
<FromGitter>
<j8r> @girng try to change `property` by `getter` when possible
<FromGitter>
<girng> ok =]
<FromGitter>
<vlazar> properties can have more logic to it than just assigning/returning instance vars
<FromGitter>
<vlazar> > @girng try to change `property` by `getter` when possible ⏎ second that
<FromGitter>
<vlazar> it's a good idea to expose as little as possible
<FromGitter>
<girng> now looking over my Client Class... if property/getter macrosdidn't exist, it would be so long omg lol. im very thankful for those MACROS :D
<FromGitter>
<epergo> i know it interprets it, but I don't know what it should do
<FromGitter>
<epergo> I mean, doc says `If you need to write a string that has many double quotes, parentheses, or similar characters, you can use alternative literals:`, obviously it doesn't say anything about newline character but at first I thought It would not interpret newline
<FromGitter>
<epergo> my bad I guess, thanks!
<FromGitter>
<girng> if you want \n, can use `p`
<FromGitter>
<epergo> yeah, my problem is that I was mocking an API for development, and wanted to return an example JSON with newline characters, so I was using `%()` syntax to create a stringified json and then when I was trying to parse it, it failed
__marty__ has quit [Remote host closed the connection]
<FromGitter>
<girng> man, im loving the hardware REPO!
<FromGitter>
<girng> is it possible to get the amount of memory used by the crystal app, instead of the entire computer?
<FromGitter>
<bararchy> @girng I think @j8r is working on specific process info right now
<FromGitter>
<girng> cool, no rush just kinda curious. ima take a whack and read some files c if any of em store anything related to that
<FromGitter>
<j8r> @bararchy exactly. Is it possible to release the version v0.2.2? (sry I've missed to change the shards.yml)
<FromGitter>
<j8r> @girng I'm working on it. I'm thinking about how to organize this, how to get the PID from an app name
<FromGitter>
<j8r> `Process.pid` can be used
<FromGitter>
<j8r> @girng if you want to spawn a fiber that monitor the CPU use, better to use now `Hardware::CPU.each_use`
Nathanaelle has quit [Ping timeout: 265 seconds]
Nathanaelle has joined #crystal-lang
<FromGitter>
<girng> oksounds great
faustinoaq has joined #crystal-lang
<FromGitter>
<j8r> I've created this because working on PIDs, and looping on`Hardware::CPU.used` can' t reuse the previously obtained CPU time
<FromGitter>
<bararchy> @j8r I already merged your PR
<FromGitter>
<j8r> Of course - talking about the tag ;-)
<FromGitter>
<j8r> and also modifying `shards.yml` :-/
<FromGitter>
<j8r> Wondering: does `Float32` enough for `/proc/uptime`?
<FromGitter>
<girng> i don't understand the answer, because top shows memory usage
<FromGitter>
<girng> of each process...
<FromGitter>
<girng> if the `top` command shows the memory used for each process, how can `there is no such thing as the actual memory usage of a process.` be true?
<FromGitter>
<j8r> look at `VmSize` in `/proc/1/status` - this is the actual memory used
<FromGitter>
<j8r> I think this is a vocabulary thing
<FromGitter>
<j8r> there is lots of memory - used, cached, buffered, shared
<FromGitter>
<girng> yeah and it's pathetic because stackoverflow won't let me comment
<FromGitter>
<j8r> In the `Hardware` we don't take the cached, shared and buffered
<FromGitter>
<girng> bcz i don't have "enough reputation"not fair at all.
<FromGitter>
<girng> they are hindering my ability to ask questions and learn over reputation
<FromGitter>
<girng> good thing crystal gitter is here to help :D
<FromGitter>
<j8r> I think he would like to said that there isn't "memory used" as is: we must calculate by removing shared, cached, buffered etc from the Total Memory
<FromGitter>
<girng> i see. to top is basically just a close estimate
<FromGitter>
<girng> to the best of knowledge
<FromGitter>
<girng> in terms of memory reading taking cached, shared, buffered into effect
<FromGitter>
<j8r> Now in recent Linuxes we have just to do `used = MemTotal - MemAvailable`
<FromGitter>
<girng> im going to be using debian 9 for game server, good idea?
<FromGitter>
<j8r> Don't really matter (but better to have a recent dist) ;-)
<FromGitter>
<j8r> Personally I like Alpine Linux, but you can't be wrong with Debian too
<FromGitter>
<girng> Alpine? isn't that a type of tree lol i like the name
<FromGitter>
<j8r> also don't forget to create a proper `systemd` / `openrc` service for your application!
<FromGitter>
<girng> like a own custom service?
<FromGitter>
<girng> daemon?
<FromGitter>
<j8r> yes
<FromGitter>
<girng> that's one thing i really miss about nodejs, they had a `pm2
<FromGitter>
<j8r> That's baaadd
<FromGitter>
<girng> but ya i need to create custom service. i think i did it before but i forgot. i bought a cheap VPS to play around with the server
<FromGitter>
<j8r> If you wan't to test you init service, you can do it with this containers https://hub.docker.com/u/jrei/
<FromGitter>
<girng> iuno what that is lol
<FromGitter>
<j8r> Really, not hard and very reliable to create a system service
<FromGitter>
<girng> i just re-install debian 9 in vps manager from host. then run my custom .sh script
<FromGitter>
<girng> if i mess up the os, i just re-install a deb 9 template lol
<FromGitter>
<girng> trial n error :DD
<FromGitter>
<girng> my host prob sees me re-install deb 9, 10-30 times a day rofl
<FromGitter>
<girng> i bet they love me =]
<FromGitter>
<j8r> haha. I will stop talking because I will not advancing on PID for `hardware` :-)
<FromGitter>
<girng> okok np ty for chat. i work on server
<FromGitter>
<DRVTiny> Help me, please, i'm totally in doubt! :( ⏎ I have 4 classes: Host, Service, HostGroup and Trigger ⏎ All this classes is no more than "msgpack-decoders" created with auto_msgpack (and some magic of my own to provide additional to_json method). ⏎ Now: i have a string that i've read using Redis.get ⏎ And i know type of class to decode this string from_msgpack ... [
Nathanaelle has quit [Read error: Connection reset by peer]
Nathanaelle has joined #crystal-lang
<FromGitter>
<DRVTiny> I.e. how to choose desired class to do from_msgpack dynamically? I know that decoded string is appropriate to, say "trigger". How to use the Trigger class to decode this string?
<FromGitter>
<bew> I'm not sure I understand what you're doing, but why not do a switch-like statement?
<FromGitter>
<DRVTiny> because all branches of that statement will do absolutely the same...
<FromGitter>
<DRVTiny> Differences will be only in class names
<FromGitter>
<bew> do you have an example of a dumb implementation of what you want?
<FromGitter>
<bew> but you'll still have a case..when..end for the class name wouldn't you?
<FromGitter>
<DRVTiny> I prefer camelCase naming scheme bit in Ruby-world using camelCase it is not comfortable IMHO
<FromGitter>
<DRVTiny> fill_this is a plain collection of different objects :)
That_Guy_Anon has quit [Ping timeout: 240 seconds]
That_Guy_Anon has joined #crystal-lang
<FromGitter>
<DRVTiny> Hmm... I can generate switch aka case statement with macro...
Nathanaelle has quit [Ping timeout: 240 seconds]
Nathanaelle has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter>
<bew> hmm yes, but that case statement is not that long, and won't probably change much later. I don't think it's worth the burden, and just make the case statement for each class
<FromGitter>
<DRVTiny> i have to create when for each redc.mget do .. end - and block inside mget may grown in the future. But... ok, macro totally satisfy me needs here
<FromGitter>
<bew> I don't get it, what do you mean by `for each redc.mget do .. end` ? if you need to repeat the whole case statement multiple time, you could do a (private) method I guess?
<FromGitter>
<DRVTiny> Hm, will it be literally: Trigger ?
<FromGitter>
<bew> yes
<FromGitter>
<Blacksmoke16> say i have a json structure like ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ currently my mapping is like `definitions: Hash(String, Definition)` which works fine but i have to use `root.definitions["bad_request"].title` vs `root.definitions.bad_request.title` which isnt a major issue but just wondering if there is a way to do the latter [https://gitter.im/crystal
<FromGitter>
<bew> yes @Blacksmoke16 don't use a hash, and use another object with only field `bad_gateway` ?
<FromGitter>
<DRVTiny> @bew Wonderful!!! Thank you very-very much again!
<FromGitter>
<Blacksmoke16> thats an option, but what if another definition gets added, would have to update the mapping, no way to get it to be dynamic without using Hash()?
<FromGitter>
<Blacksmoke16> hmm neat, ill have to make a comment and revisit this when that gets released
<FromGitter>
<Blacksmoke16> hash will work for now
<FromGitter>
<Blacksmoke16> the json is the definition of a swagger api, so trying to keep things as generic as possible for if/when the schema changes and stuff
<FromGitter>
<sherjilozair> What's the best source for learning how to write idiomatic crystal?
<FromGitter>
<bew> the compiler, and tools around it developed by core developpers
<FromGitter>
<sherjilozair> @bew Are there any parts of the compiler that are relatively stand-alone?
<FromGitter>
<j8r> you can learn from the stdlib
<FromGitter>
<sdogruyol> std is pretty nice to read
<FromGitter>
<bew> oh yes and the stdlib of course (ty @j8r )
<FromGitter>
<sherjilozair> stdlib is crystal/src/ excluding compiler/ right?
<FromGitter>
<bew> yes!
<FromGitter>
<Blacksmoke16> is there a shortcut to doing .not_nil! on stuff
<FromGitter>
<Blacksmoke16> using JSON.mapping
<FromGitter>
<Blacksmoke16> or something
<FromGitter>
<bew> huh? no, no shortcut, but you shouldn't need it often
<FromGitter>
<bew> what do you mean `using JSON.mapping` ?
<FromGitter>
<Blacksmoke16> nvm was thinking of something else
<FromGitter>
<sherjilozair> Is there no fold function in crystal?
<FromGitter>
<Blacksmoke16> Is there support for $ref in my mappings?
<RX14>
@sherjilozair that's a reduce
<RX14>
crystal uses map and reduce terminology not map and fold
<RX14>
and it's only really on arrays
<RX14>
i mean we don't have trees or such in the std anyway
<FromGitter>
<sherjilozair> @RX14 Anyway to get the intermediate results from the reduce?
<RX14>
...why?
<RX14>
i mean you could just do array << accum in the reduce
<FromGitter>
<bew> @Blacksmoke16 what is that?
<FromGitter>
<sherjilozair> i.e. say I want to construct [1, 1*2, 1*2*3, 1*2*3*4] from [1, 2, 3, 4]
<FromGitter>
<sherjilozair> @RX14 Do you see editted stuff in IRC?
<RX14>
no
<FromGitter>
<sherjilozair> Or shoudl I repost?
<RX14>
and thank god
<FromGitter>
<Blacksmoke16> i think its a swagger specific thing, where you can reference other objects
<FromGitter>
<girng> what is swagger? new language?
<FromGitter>
<girng> checking it out now
<FromGitter>
<j8r> API doc, has chnaged its name recently
<FromGitter>
<sherjilozair> The *s mess with gitter, but I guess it's visible to you in IRC.
<FromGitter>
<sherjilozair> @RX14 Do you see what I want? Any way to do it pure functionally?
<FromGitter>
<sherjilozair> Without <<.
<RX14>
well you can do anything with a fold purely functionally if you want
<RX14>
it'll just be messy
<FromGitter>
<bew> @Blacksmoke16 yeah no, that's not supported on a generic JSON implementation, you'll have to support that yourself in some ways. What are you doing in Crystal with swagger?
<RX14>
you can transliterate your fancy pantsy haskell if you want but it'll be faster and better and more readable to do it imperatively
<RX14>
because crystal is an imperative language
<RX14>
going against the flow in any language typically gets you bad code
<FromGitter>
<girng> "fancy pantsy" rofl
<FromGitter>
<Blacksmoke16> currently have a ruby script im rewriting into crystal that consumes a swagger.json file, and outputs a transformed json structure and javascript functions
<RX14>
>> (1..4).reduce([] of Int32) { |arr, i| arr << arr.last + i }
<FromGitter>
<bew> you could also allocate an array of the correct size, and populate it directly in reverse (from the end to the beginning)
<RX14>
yeah
<RX14>
that'd be a bit ugly though
<RX14>
the reverse is fairly efficient
<FromGitter>
<bew> hmm maybe, didn't check how that works yet
<RX14>
it's easy
<FromGitter>
<sherjilozair> Yeah, my own goal is to avoid ugly code. I don't care a lot for performance here, since the array is going to be very small.
<RX14>
you just swap(i, size - i) for i in (0..size/2)
<RX14>
swap is simple O(1)
<FromGitter>
<bew> oh right, good then
<RX14>
plus handling the odd case
<RX14>
but
<RX14>
you get the idea
<RX14>
@sherjilozair I wouldn't call that overly ugly though
<RX14>
although the reduce I wrote is shorter
<RX14>
but it's probably slower because of the reading into last
<RX14>
@sherjilozair I suggest you either write your own accumulate function or suggest it on github
<RX14>
i'm not 100% that it'd get accepted
<FromGitter>
<bew> yeah I remember I did that technique at school now ^^
<RX14>
except we actually do it with pointers lol
<RX14>
we calculate the pointers
<RX14>
and loop with a swap pointer values and then += 1 -= 1 until they meet
<FromGitter>
<sherjilozair> So reverse_each and each_with_index exist, but no reverse_each_with_index.
<RX14>
yes
<FromGitter>
<sherjilozair> I could use reverse_each_with_index it for this example. Would it get accepted if I add it?
<RX14>
i still don't get why we don't just have each and reverse_each take counters
<RX14>
probably
<RX14>
idk
<FromGitter>
<girng> github asking meto verify me email twice now...
<RX14>
i wish I knew what the mob wants the collections API to look like today
<FromGitter>
<bew> RX14, like: always be with_index, and in the block you use the second arg or not based on your needs?
<FromGitter>
<sherjilozair> @RX14 You mean just pass the counters along if there are two variables?
<RX14>
@bew yes
<FromGitter>
<sherjilozair> Which mob are you talking about? :D
<RX14>
@sherjilozair trailing block args are always ignored
<RX14>
@sherjilozair the ones on github issues
<FromGitter>
<bew> that looks good, can you issue that?
<RX14>
@bew i'm sure last time i proposed it that ary said that the overhead of maintaining a flipping counter when it's not required were too much
<RX14>
but maybe I should just PR it
<FromGitter>
<sherjilozair> You'll have my +1.
<FromGitter>
<bew> don't you think LLVM can optimize that away?
<FromGitter>
<girng> ok plz dont ask use case i jus twant to know how to do this
<FromGitter>
<girng> i want to use crystal, to execute a cmd in the linux console, and get its output
<FromGitter>
<girng> is this possible?
<RX14>
@girng well the main point of call for that is Process.run
<FromGitter>
<girng> ok i'll take a look at api ty
<RX14>
@bew yes I do think that
<FromGitter>
<girng> dang, no examples in Process docs :X
<FromGitter>
<girng> so i don't use Process at all
<FromGitter>
<girng> just backticks
<RX14>
depends on usecase
<FromGitter>
<girng> just for string output
<RX14>
you can outgrow backticks pretty quickly
<FromGitter>
<j8r> You may want to change the `Process` behavior e.g. not runiing in `sh`, directly call the binary `ls`
<RX14>
meh
<FromGitter>
<girng> ok, my apologies then i thought I had to do Process.\`cmd\` or something iw as like that's not right :P
<FromGitter>
<girng> since that's in the Process class
<RX14>
no it's not
<RX14>
it's in process.cr
<RX14>
look at the indent
<RX14>
it's a method at the top level
<FromGitter>
<girng> oh
<FromGitter>
<girng> yep, nvm you r right
<FromGitter>
<girng> ok. so oprypin is gonna kill me for asking this but...
<RX14>
if oprypin will kill you, I probably will
<FromGitter>
<girng> if let's say `command` with a small output..like say 10 characters or w/e, just a small command. if re-using it over and over like, let's say inside a loop do sleep 1.0 end cause any memory issues?
<FromGitter>
<sherjilozair> Don't let the mob silence you @girng . Speak your heart.
<FromGitter>
<girng> i wont have any memory leak issues right, it gets cleared? just more cpu intensive
<FromGitter>
<girng> if called ALOT
<FromGitter>
<j8r> no, the sub process exits
<RX14>
@girng yeah it'd be fine
<FromGitter>
<girng> ok sweet, ty just OCD about memory stuff lol
<FromGitter>
<j8r> also depend of the script
<RX14>
i've never created a memory leak in crystal
<FromGitter>
<girng> i try not to ask but i can't help it
<RX14>
we should probably accept shell: "/bin/dash" as well as shell: true
<FromGitter>
<girng> interesting indeed
<FromGitter>
<girng> i find it kinda cool how all the problems i have w/ crystal there is a solution for em. and it's just not a solution, but it's implemented really easily. syntaxically too. for example, backticks for command.
<FromGitter>
<j8r> Why i told you that? Because now your used has probably /bin/bash, and the default of Debian/Ubuntu is /bin/sh. If you launch your new server with a new custom user, it may have no default shell
<FromGitter>
<girng> oh @rx14 i know what was happening earlier
<z64>
i don't think there's really anything your can practically do to improve them, but that might give you some insight as to what the compiler is doing
<FromGitter>
<j8r> @bararchy Thanks, still working on PID. 0.3.0 in the following days :-)
<FromGitter>
<j8r> @bararchy I'm on Manjaro and don't have this bug, strange?!
<FromGitter>
<girng> @z64 Do you think maybe because I'm on WSL it could affect it? I heard WSL is pretty "native"
<FromGitter>
<bararchy> Awesome, when you add it I'll try and create a small example for the project that does HTOP style system stats
<z64>
i'm totally unfamiliar with WSL
<FromGitter>
<girng> But, I wonder if it's because of the requires I have
<FromGitter>
<girng> those are all my requires, that could be it, right?
<FromGitter>
<bararchy> @j8r I also found a bug with Arch Linux not showing mem as it should, I'll look into it
<FromGitter>
<girng> is it possible to "statically" compile the main requires above "hardware"? like in the crystal code, so they don't all get compiled each time
<FromGitter>
<girng> if that makes sense, lol hard to explain
<FromGitter>
<girng> oh, i have another question. i wonder if the usage of comments effects compile time? does the tokenizer or w/e its called, have to strip all the comments? before running, or what? because in my LoginHandler.cr file, it's 25KB in size, and each game method has a commend block (3lines) above it, with a description
<FromGitter>
<girng> or.. is that negligible?
<z64>
no it doesn't, parsing is extremely fast
<FromGitter>
<girng> ok, yeah just checkin
<z64>
comments are just ignored entirely and won't make it into the later compiler phases where most of the time is spent (semantics / codegen, etc - look at the stats printout you made)
<FromGitter>
<sdogruyol> 25kb sounds big
<FromGitter>
<girng> hmm maybe it's mysql
<FromGitter>
<girng> connecting
<z64>
thats why i said to use `build` :p
<FromGitter>
<girng> u did?sorry didnt c
<FromGitter>
<girng> 1 sec le tme scroll up
<z64>
but it roughly adds up to 3/4 seconds anyways from what i can see from your paste
<FromGitter>
<girng> `crystal build foo.cr -p`? ok
<z64>
right, or `--stats`
<FromGitter>
<girng> HOLY
<FromGitter>
<girng> rofl
<FromGitter>
<girng> if i build, and then do ./MasterServer
<FromGitter>
<girng> it connects to mysql INSTANTLY, no load at all!
<z64>
lol. anyways, i gotta go. good luck
<FromGitter>
<girng> ok ty
<FromGitter>
<girng> have nice day ttyl
<FromGitter>
<girng> ok. if i do `crystal build src/MasterServer.cr -p && ./MasterServer`, it seems like it's faster than just `crystal src/MasterServer.cr` lol what is this sorcery
<FromGitter>
<sdogruyol> WSL magic?
<FromGitter>
<girng> hahaah
<FromGitter>
<girng> im going to do some trial n error, remove some requires
<FromGitter>
<girng> see if i can hone down whats making it take the 5 seconds
<FromGitter>
<girng> ok so i commented out `MasterServer.new("0.0.0.0", 9300)`
<FromGitter>
<girng> time went back down to 2seconds
<FromGitter>
<girng> so yeah, this class is fck'd lmao
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
<FromGitter>
<girng> ok so im been look around. not sure if this is the cause but. my LoginHandler.cr file looks ike this (25kb big): ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ continues with 29 more methods. that could be it? [https://gitter.im/crystal-lang/crystal?at=5ae38f34270d7d370813641d]
<FromGitter>
<bew> probably not
<FromGitter>
<branconinja> hey guys!
<FromGitter>
<branconinja> I am new on crystal
<FromGitter>
<branconinja> How can I be part on the github organization?
<FromGitter>
<branconinja> What I need to do?
<FromGitter>
<girng> ok gn. need sleep i be back 3-5 hours!
<RX14>
@branconinja well you start by being helpful on the issue tracker and writing PRs, but it also requires to go above and beyond in terms of having a deep understanding of the language and being opinionated
<FromGitter>
<bew> also, as you're new to Crystal, you can try to make a few projects in Crystal, learn how to use the language in the current state, come here if you have any questions, and as you gain experience in Crystal, try to participate on the issues/PRs
<FromGitter>
<branconinja> thanx <RX14> but I would like to be part of the editor-tools that is more simple lol
<FromGitter>
<branconinja> thank you for the tips
<FromGitter>
<j8r> @girng you don't sleep much - stop crystal now!
Jenz has joined #crystal-lang
<RX14>
@branconinja the editor tools stuff isn't official
<RX14>
you'll have to ping someone who does that stuff
<oprypin>
branconinja, you can contribute to anything you want without being part of an organization on paper
<FromGitter>
<j8r> @branconinja be apart of an organization isn't just to belonging to it, in the first place this is to have more rights on the repositories, to do more extensive work
faustinoaq has quit [Quit: IRC client terminated!]
<oprypin>
right
<FromGitter>
<j8r> There is no point to be granted of rights that we won't use (properly)
<FromGitter>
<j8r> But don't worry @branconinja , you are Brazilian right? I'm pretty sure you can have your chance in https://github.com/CrystalBR if you ask to @hugoabonizio :-D
faustinoaq has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
sz0 has joined #crystal-lang
Nathanaelle has quit [Ping timeout: 265 seconds]
<FromGitter>
<j8r> How can I do this work `File.basename File.read("/proc/1/cmdline")`? Exception: `String contains null byte (ArgumentError)`
<FromGitter>
<j8r> there is a method to check null byte for `String`, but how remove them?
<FromGitter>
<bew> whaat are you doing? why are your trying to do basename on sth that's not a file path