<FromGitter>
<carsonbaker> I don't know what you're trying to do though.
<FromGitter>
<carsonbaker> or use ```.bytes``` if you want the value as an Array(UInt8)
<FromGitter>
<eliasjpr> That works Carson
<FromGitter>
<eliasjpr> Thank you
<FromGitter>
<carsonbaker> sure
<FromGitter>
<eliasjpr> Very much appreciated
<FromGitter>
<exts> So I'm trying to figure out if this is normal behavior from crystal https://gist.github.com/exts/96b288a220469c4af519df0721f57b5b and why does this run? ⏎ ⏎ Is it because the include puts the whole file inside the Root namespace?
<FromGitter>
<exts> I was expecting it to error out since that's a protected method, in the docs it says when you include inside a module you have access to protected methods, but when i include in a file directly it still works which means im assuming it puts that whole file inside that module?
<FromGitter>
<carsonbaker> yeah. and, as expected, it errors when trying the same thing with private methods.
<FromGitter>
<exts> yeah but this isn't about private methods
<FromGitter>
<exts> is that expected behavior?
<FromGitter>
<exts> when you include outside of a module i still have access to protected methods?
<FromGitter>
<carsonbaker> it seems like a real subtle thing. i don't know. what does ruby do?
<FromGitter>
<exts> i don't know, not a ruby programmer
<FromGitter>
<bew> No I don't think it's expected, the protected should apply to `Test1` scope, not `Root`
<FromGitter>
<exts> should I create a new issue? to see what asterite and co thinks?
<FromGitter>
<carsonbaker> ```code paste, see link```
<FromGitter>
<bew> yes, open an issue!
<FromGitter>
<exts> will do
<FromGitter>
<exts> well first let me search :), i'm bad at that sometimes
<FromGitter>
<bew> you can include my carc in links for easy proof in the issue
<FromGitter>
<exts> thanks, will do
<FromGitter>
<exts> Alright I posted it #4315 hopefully I was descriptive enough, haven't ran into an issue like this before (not that it stops me from working) - possibly found my first compiler bug? :D
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
jfontan has joined #crystal-lang
jfontan has quit [Remote host closed the connection]
jfontan has joined #crystal-lang
elia has joined #crystal-lang
elia has quit [Client Quit]
bjz has joined #crystal-lang
A124 has joined #crystal-lang
jfontan has quit [Quit: jfontan]
jfontan has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 255 seconds]
Qchmqs has quit [Ping timeout: 260 seconds]
<Papierkorb>
Looks like someone from you all passed my info on to their company's HR department. I hope you enjoy your bonus. ;P
<FromGitter>
<sdogruyol> what?
<Papierkorb>
?
<FromGitter>
<drosehn> passed info to an HR office? whose HR office?
z64 has joined #crystal-lang
<z64>
anyone seen any rethink ORMs about? going to be using CT's driver, but some basic class mapping would be great
<Papierkorb>
drosehn, the person gave my information to a HR/recruiter of their company
NIk-- has joined #crystal-lang
<FromGitter>
<nicck> I've recently found StaticArray in API docs, and now I'm not sure when I should use StaticArray and when Tuple if I need fixed-size stack-allocated sequence of values of the same type. Is there any difference between them in such case?
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/v9el9
<crystal-gh>
crystal/master 919bc4c Jonne Haß: Rename HTTP::Params.from_hash to HTTP::Params.encode and add an overload...
<crystal-gh>
[crystal] bcardiff pushed 1 new commit to master: https://git.io/v9eEv
<crystal-gh>
crystal/master 24c8321 Brian J. Cardiff: Document WeakRef...
<crystal-gh>
[crystal] bcardiff merged changelog into master: https://git.io/v9ezf
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<BlaXpirit>
nicck, if u need 10 items you're not gonna write `{Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32}`, hopefully that answers your question
<BlaXpirit>
tuple is fixed size, different types; staticarray is compiletime size, same types
<BlaXpirit>
note that compiletime is less strict than fixed, you can factor things out into a constant and stuff like that
McSoFake has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
<FromGitter>
<codenoid> @FromIRC but i have a big ideas
<FromGitter>
<schoening> "At least for now, WebAssembly does not support garbage collection at all. " ⏎ Oh gee :( No crystal for my web stuff then I suppose..
<FromGitter>
<bew> @schoening yeah, wasm is not yet ready gc-ed language, but I know that there are discussions about that... The time will come!
<FromGitter>
<schoening> I sure hope so! Cross platform app and good performance would be great :D
<FromGitter>
<exts> Working on an Algolia api wrapper for work, not sure if I'll use it though https://github.com/exts/Crolia was interesting writing most of it. Didn't realize how good the crystal standard library was until yesterday.
<FromGitter>
<mverzilli> @exts why wouldn't you use it? did you hit any roadblocks?
<FromGitter>
<exts> oh, none so far
<FromGitter>
<exts> i'm just under a time constraint lol
<FromGitter>
<mverzilli> lol :P
<FromGitter>
<exts> and my primary language already has a wrapper, but I think crystal would be faster which is why i started the project. eventually i want to convert w/e I write to use some of my crystal code in the backend :)
<FromGitter>
<exts> plus I just find it fun writing crystal code so that's the biggest reason :)
fryguy9 has joined #crystal-lang
zipR4ND has joined #crystal-lang
unshadow has joined #crystal-lang
<zipR4ND>
hi all, two weeks ago we spoke about regexps and performance. no I implemented a NFA/DFA https://github.com/ziprandom/crystal-dfa. Like expected it beats PCRE on pathologic expressions, but for the practical ones it still lacks behind slightly. I'm new to this, so any feedback is appreciated :)
<FromGitter>
<bew> awesome
<FromGitter>
<bew> !
<unshadow>
I want to pass around a logger object between my classes (all under the same module name), in Ruby, I usually just inject the object I want everywhere to the Object class, but in Crystal it seems to raise an Invalid mem access. Except from setting it as a global, any other ideas ?
<zipR4ND>
unshadow: do you instanciate these classes? then you could pass the logger to the instances via some set_logger method ...
<RX14>
unshadow, use a global
<RX14>
just class_property on some module
<RX14>
and then YourNamespace.logger
<RX14>
simple
<unshadow>
RX14: Good idea !
<unshadow>
thanks
xmonader has joined #crystal-lang
<RX14>
zipR4ND, why do you add alphanum? to Char
<RX14>
ascii_alphanumeric? exists
<zipR4ND>
RX14: yeah already found out about that ..
<zipR4ND>
I will fix that ...
<zipR4ND>
don't even use it anywhere ..
<RX14>
and each_char.all(&.ascii_alphanumeric?) is a better implementation for the one on String
<RX14>
you want to find everywhere where you do needless memory allocations
<RX14>
or memory copies
<RX14>
obviously your algorithmic complexity will dominate
<RX14>
but thats already optimized i'm sure
<RX14>
so after that you need to think like a C programmer
<zipR4ND>
nice already down from 2.67xPCRE to 1.64x
<zipR4ND>
and this is where the problems start: never been a C programmer
<zipR4ND>
I'm this new generation of programmers crystal will create ...
<FromGitter>
<codenoid> you twice RX14 and zipR4ND talkng to me ?
<zipR4ND>
yeah, atm. it's pretty simple already. you have the DState who is identified by a list of nfa states and has the next hash which holds the next state for a given input segment .. thats all
<zipR4ND>
the rest of the code is parsing and building NFA and then DFA
<zipR4ND>
which could be optimized, I'm sure but the priority is matching speed, not parsing
marius has quit [Quit: leaving]
<RX14>
@codenoid ??
<FromGitter>
<codenoid> oh, i dont think so
<RX14>
zipR4ND, the pcre source code will have all sorts of dirty C tricks you'll never imagine in i'm sure
<zipR4ND>
no time now to implement the lookuptable
<RX14>
lookup table will turn your core match loop into like 10 instructions for ascii maybe
<RX14>
although you'll probably want to perform optimizations for large linear lookups eventually too
<RX14>
using the algorithm used in that grep article
<RX14>
when there's no matching apart from "find this string" you'll want to implement that kind of stuff from the article, but that kind of optimization can probably wait
<RX14>
you should use Pointer(UInt8).malloc for the lookup table
<RX14>
then you can get rid of the bounds check and replace it with your own
<zipR4ND>
ok
<zipR4ND>
will look into that soon
<zipR4ND>
atm. it seems im two times faster thats what I want because the end boss is libgraphqlparser
<zipR4ND>
haha, ok thanks very much RX14 I have to go now ... I will look into your advice for implementing the lookup table. what I learnde from russ cox is that there are situations in which the nfa runs faster
<RX14>
ok
<RX14>
glad to help
<zipR4ND>
we have both, so we can run @nfa in this situations .. (RE2 style ..)
ltran has joined #crystal-lang
ltran has quit [Client Quit]
huggles has joined #crystal-lang
zipR4ND has quit [Ping timeout: 260 seconds]
<FromGitter>
<exts> has anyone written any cool articles on macros? i feel like that's my weak point in crystal atm
<FromGitter>
<exts> will check it out, not sure if I've seen this one
fryguy9 has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
bjz has joined #crystal-lang
fryguy9 has quit [Quit: Leaving.]
greengriminal has quit [Quit: Leaving]
Renich___ is now known as Renich
xmonader has quit [Ping timeout: 258 seconds]
unshadow has quit [Ping timeout: 240 seconds]
unshadow has joined #crystal-lang
<FromGitter>
<eliasjpr> Im trying to compile a crystal program and Im getting this output `Error: file 'demo' is not a valid Crystal source file: Unexpected byte 0xfa at position 1, malformed UTF-8`
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<dmitryrck> no idea, did you check the encoding of the file?
<FromGitter>
<dmitryrck> try removing some "non-ascii" character, maybe that is the problem :|
xmonader has joined #crystal-lang
xmonader has quit [Ping timeout: 240 seconds]
<FromGitter>
<eliasjpr> Yeah looking line by line now go figure
huggles_ has quit [Quit: Lost terminal]
<FromGitter>
<drosehn> Are you compiling the file that you intended to compile? Are you compiling 'demo' or 'demo.cr', for instance?
<FromGitter>
<eliasjpr> Ahh! Never mind, I'm running the compiled program with crystal command
<FromGitter>
<bew> aahahahahaha (sorry)
<FromGitter>
<eliasjpr> Brain fart🙅🏻♂️
<FromGitter>
<eliasjpr> After 8 hours of work can think clearly
<FromGitter>
<eliasjpr> We all have had that moment
<FromGitter>
<eliasjpr> So we good
<FromGitter>
<eliasjpr> 😀
<FromGitter>
<codenoid> > We all have had that moment
<FromGitter>
<bew> yeah^^
<FromGitter>
<dmitryrck> ;)
xmonader has joined #crystal-lang
<FromGitter>
<exts> i've tried so many languages in the last 2 years. only one's i like right now is crystal and nim. something about just being able to get up and going in a matter of seconds w/ the build tools is nice and the syntax, simple/elegant :sparkles:
<FromGitter>
<bew> totally agree (but that I never really tried nim :) )
<FromGitter>
<exts> nims pretty cool, did some fun SDL2 stuff in it