ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
ma__ has joined #crystal-lang
ma__ has quit [Client Quit]
<FromGitter> <Blacksmoke16> TIL in PHP `empty("\x20"); # => false`
<FromGitter> <Blacksmoke16> +1 for `#blank?` handling those :P
<FromGitter> <watzon> +11
<FromGitter> <Blacksmoke16> kinda makes my normalizer thing a bit less useful for a `NotBlank` assertion ha
<FromGitter> <Blacksmoke16> ill keep it in there just in case i guess :shrug:
<FromGitter> <watzon> @Blacksmoke16 I've seen a lot of talk of assertions and such, what are you working on?
<FromGitter> <Blacksmoke16> splitting out the assertion stuff i have in `CrSerializer` into its own shard
<FromGitter> <Blacksmoke16> along with a refactor thats much much better than it was
<FromGitter> <Blacksmoke16> ☝️ August 19, 2019 7:10 PM (https://gitter.im/crystal-lang/crystal?at=5d5b2c4e9507182477104290)
<FromGitter> <Blacksmoke16> is the overview if you missed it
<FromGitter> <Blacksmoke16> is pretty noice
<FromGitter> <watzon> Ahh that is nice
<FromGitter> <Blacksmoke16> changed a bit since then, but same idea
<FromGitter> <Blacksmoke16> added benefit is, since the assertion classes are newed up as needed, would also be able to use DI to inject external services into it
<FromGitter> <Blacksmoke16> but its coming along, im open to ideas/suggestions
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d5de2a9c508da44c35c7897]
<FromGitter> <watzon> That's pretty awesome
<FromGitter> <Blacksmoke16> is what the not blank one looks like atm
<FromGitter> <Blacksmoke16> thanks :)
<FromGitter> <watzon> Tbh I was kind of hoping you were working on a testing framework 😂 but this is really cool too
<FromGitter> <watzon> I want rspec
<FromGitter> <Blacksmoke16> i want mockery :p
<FromGitter> <Blacksmoke16> i never used any spec lib in ruby so im content with crystal's built in stuff
<FromGitter> <Blacksmoke16> coming from like jasmine/phpunit is some stuff that would be cool but isn't required
<FromGitter> <watzon> Yeah, tbh what I want more than anything is a better documentation generator
<FromGitter> <watzon> YARD has so many features that we're lacking right now
<FromGitter> <Blacksmoke16> like what?
<FromGitter> <Blacksmoke16> i havent really hit anything (except the inherit docs which is in PR now :))
<FromGitter> <Blacksmoke16> but maybe i'll want it after i know its a thing ha
<FromGitter> <Blacksmoke16> that i was like "oh i wish i could do x"*
<FromGitter> <watzon> YARD has a macro system which you can use to create custom doc sections, groups for grouping like methods, flags like `@api`, `@private`, `@see` etc which add metadata, the ability to do custom templates, etc etc
<FromGitter> <watzon> Really what I want more than anything is custom template support. But the other stuff is really handy too, like being able to define your own metadata flags which can be used in those custom templates.
<FromGitter> <Blacksmoke16> custom template like `@include common_stuff`
<FromGitter> <Blacksmoke16> ? or?
<FromGitter> <watzon> Like a custom theme
<FromGitter> <watzon> Instead of the default purple sidebar business
<FromGitter> <Blacksmoke16> ah
fyber has quit [*.net *.split]
justinmcp_ has quit [*.net *.split]
_whitelogger has joined #crystal-lang
<FromGitter> <fridgerator> Hey guys, hows crystal? I havent been around in a while
ma_ has joined #crystal-lang
<FromGitter> <fridgerator> and gals*
<FromGitter> <fridgerator> and phreaks*
<FromGitter> <Blacksmoke16> its going
<FromGitter> <fridgerator> It seems like windows suppot has stalled since RX14'swork
<FromGitter> <Blacksmoke16> is a PR for fiber support atm
<FromGitter> <fridgerator> by straight shoota?
<FromGitter> <Blacksmoke16> yea
<FromGitter> <fridgerator> I saw that, thats cool 👍
<FromGitter> <Blacksmoke16> indeed
moei has quit [Quit: Leaving...]
<FromGitter> <sam0x17> another development that went sort of under the radar is https://up.docs.apex.sh/ has crystal support so you can write serverless web apps in crystal using whatever crystal framework you want
ma_ has quit [Ping timeout: 250 seconds]
<FromGitter> <sam0x17> I definitely would recommend (though amusingly their example program has a syntax error because the guy doesn't use crystal)
<FromGitter> <sam0x17> and you'll be better off using an alpine docker image in your functions so static linking works
duane has quit [Ping timeout: 245 seconds]
<FromGitter> <rmarronnier> The API Crystal docs says that Crystal only uses utf-8 strings by default. I need to write some Regex that takes utf-16 characters codes. Is there a way to do it ?
<FromGitter> <Blacksmoke16> There's a method for that
<FromGitter> <rmarronnier> oh
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/String.html#from_utf16(pointer:Pointer(UInt16)):Tuple(String,Pointer(UInt16))-class-method not sure if thats what you need tho?
<FromGitter> <rmarronnier> Yeah not sure : ` invalid regex: disallowed Unicode code point (>= 0xd800 && <= 0xdfff)`
<FromGitter> <Blacksmoke16> could also try just doing like `String.new bytes`
<FromGitter> <rmarronnier> I don't know how I can use this method to convert unicodes points in my regex
<FromGitter> <Blacksmoke16> got some example code?
<FromGitter> <rmarronnier> hmm
<FromGitter> <rmarronnier> `jpn: /[\x{3041}-\x{3096}\x{309D}-\x{309F}]|[\x{30A1}-\x{30FA}\x{30FD}-\x{30FF}\x{31F0}-\x{31FF}\x{32D0}-\x{32FE}\x{3300}-\x{3357}\x{FF66}-\x{FF6F}\x{FF71}-\x{FF9D}]|\x{D82C}\x{DC00}/`
<FromGitter> <Blacksmoke16> what do you need regex for?
<FromGitter> <rmarronnier> To look for scripts used in a text (for language detection)
<FromGitter> <Blacksmoke16> oh so you just want to write regex that matches utf-16 chars?
<FromGitter> <rmarronnier> I can take out all \x{Dxxx} to make it work, but I'd prefer not to
<FromGitter> <rmarronnier> yes :-)
<FromGitter> <Blacksmoke16> ah then i dunno, not real familiar with that
<FromGitter> <rmarronnier> np, in unicode hell, no one can hear you scream :-p
<FromGitter> <watzon> @rmarronnier what's wrong with what you have? It looks good to me.
<FromGitter> <Blacksmoke16> isnt there some `u` regex flag?
<FromGitter> <rmarronnier> This not a valid Regex expression unless I remove all \x{Dxxx}
<FromGitter> <rmarronnier> `unknown regex option: u`
<FromGitter> <Blacksmoke16> i meant just in general :P
<FromGitter> <rmarronnier> haha :-)
<FromGitter> <watzon> I'm trying to remember where I had to work with unicode ranges before
<FromGitter> <watzon> I know I have some code somewhere
<FromGitter> <rmarronnier> From the API docs > PCRE supports other encodings, but Crystal strings are UTF-8 only, so Crystal regular expressions are also UTF-8 only (by default).
<FromGitter> <rmarronnier> @watzon thanks but I'm not that hopeful :-p
<FromGitter> <watzon> Ahh right, you're hoping to match on utf16 chars. @asterite should be able to say if it's possible, but I'm not hopeful either.
<FromGitter> <watzon> If not Crystal definitely needs utf16 support
<FromGitter> <watzon> An object's hash should always be unique to that object shouldn't it?
beepdog has joined #crystal-lang
<FromGitter> <rmarronnier> Not sure where you want to go with this...
<FromGitter> <rmarronnier> oh sorry :-)
<FromGitter> <watzon> Lol no worries
<FromGitter> <sam0x17> you might have an easier time just doing everything with byte slices @rmarronnier unless your regex has complex logic to it. If you're just scanning for utf-16 characters you could just treat that as a particular sequence of bytes that you're looking for etc
<FromGitter> <sam0x17> you might be able to get the same approach "working" in utf-8 if your utf-16 characters happen to be representable (in terms of the raw bytes) in utf-8 as maybe two characters
<FromGitter> <sam0x17> but I bet the dynamic lengths would mess with that approach
<FromGitter> <sam0x17> yet another approach would be to up-convert to utf-32, which at least has consistent 4 bytes per character no matter what, and then do your logic in there