ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
ur5us has joined #crystal-lang
postmodern has joined #crystal-lang
<postmodern> is there a way of getting the encoding of a String ? I noticed you can call String#encode to encode the String into another encoding, but how do I determine the encoding of a String
<FromGitter> <Blacksmoke16> wouldnt it always be UTF-8
<FromGitter> <Blacksmoke16> `#encode` returns `Bytes` so yea...
<postmodern> hmm
<postmodern> so when you encode a String or create a String.new with an encoding, it really just converts back down to UTF-8 again?
<postmodern> also does String#tr not support "^\xHH-\xHH" char ranges?
<postmodern> trying to do `string.tr("^\x20-\x7e", ".")`
<FromGitter> <Blacksmoke16> idk about the converting part, is possible it just wouldnt be valid
<postmodern> is there a better way than /[^[:print:]]/ for determining if a UTF-8 char is a printable char?
<FromGitter> <Blacksmoke16> what is the definition of `[:print:]`?
<FromGitter> <Blacksmoke16> i think you could just do like `!chr.control?`
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Char.html#control?:Bool-instance-method
<postmodern> ah interesting
<FromGitter> <Blacksmoke16> checks if the char is in any unicode control category
<postmodern> would that also include unknown unicode code points?
postmodern has quit [Remote host closed the connection]
<FromGitter> <HertzDevil> what do you mean by "unknown"
<FromGitter> <HertzDevil> the General_Category of a code point is always "known" in the sense that all unassigned code points and non-characters have the value Cn
<FromGitter> <HertzDevil> though of course the same codepoint's General_Category could be changed as `Unicode::VERSION` increments (as we did a few days ago)
<FromGitter> <Dan-Do> when compiling a project with C binding, compiler said `undefined fun 'ejdb_init' for EJdb::LibEjdb` ⏎ The function is there in the lib `fun init = ejdb_init : Iwrc`. What else should be investigated?
<FromGitter> <Dan-Do> When compiling a project with C binding, it said ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ What should be investigated? [https://gitter.im/crystal-lang/crystal?at=6155390529ddcd0293f70dbb]
ur5us has quit [Ping timeout: 245 seconds]
Volk has joined #crystal-lang
Volk has joined #crystal-lang
Volk has quit [Changing host]
ur5us has joined #crystal-lang
<FromGitter> <naqvis> you need to find which library have this method , then link that as well
<FromGitter> <naqvis> all you have to do is look into how your target library compiles or have external dependencies, then link them together
<FromGitter> <Dan-Do> That's so great! I solve it, we need to add more static files, like this ⏎ `@[Link(ldflags: "#{__DIR__}/lib_1.a #{__DIR__}/lib_2.a #{__DIR__}/.....a")]`
<FromGitter> <naqvis> 👍
<FromGitter> <Dan-Do> dump question ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ error `argument 'ejdbp' of 'LibEjdb#close' must be Pointer(LibEjdb::Ejdb), not LibEjdb::Ejdb` [https://gitter.im/crystal-lang/crystal?at=615587c998c13e7550abce84]
<FromGitter> <Dan-Do> If I added `pointerof` to `LibEjdb.close(pointerof(@db))` the error went. This question is, in the lib, those two function's parameter `ejdbp` is declared the same `ejdbp : Ejdb*`, why in crystal we have to add `pointerof` at the `close`?
<FromGitter> <Dan-Do> The question is, in the lib, those two function's parameter `ejdbp` is declared the same `ejdbp : Ejdb*`, why in crystal we have to add `pointerof` at the `close`?
ur5us has quit [Ping timeout: 245 seconds]
<FromGitter> <Dan-Do> Oops, found the answer at this link https://crystal-lang.org/reference/syntax_and_semantics/c_bindings/out.html
<FromGitter> <Dan-Do> out = pointerof
<FromGitter> <DRVTiny> How can i do this? ⏎ def proc1; end ⏎ puts proc1.class ⏎ ⏎ If all is an instance/class in Crystal - why named method is not object and... what is it in such case? [https://gitter.im/crystal-lang/crystal?at=6155903e7db1e3753e1505e9]
<FromGitter> <DRVTiny> I expect to have syntax like &procedure.class or &procedure.call(*arguments) , but that seems not possible at all
<FromGitter> <HertzDevil> `puts (->proc1).class`
<FromGitter> <DRVTiny> But Proc is a new object created from method. And what is method itself?
<FromGitter> <HertzDevil> what's the problem with that
<FromGitter> <DRVTiny> I want some proc that accepts name of other procs to call, such as ⏎ call_this_procs(proc1, proc2, proc3) ⏎ It is very frustraing syntax call_this_procs((->proc1), (->proc2), (->proc3)) for such simple thing ⏎ But... i can use macroses eventually... [https://gitter.im/crystal-lang/crystal?at=61559235ee6c260cf7f1c325]
<FromGitter> <DRVTiny> For example, in golang i can ⏎ func call_fns(fns ...func(int) int) { } ⏎ call_fns(func1, func2, func3)
<FromGitter> <HertzDevil> that's because they are functions, and methods are not functions
<FromGitter> <DRVTiny> But if Crystal is totally OOP-driven, then method of class is an instance of some class itself by definition ⏎ For example ⏎ class A; end ⏎ puts A.class ⏎ => Class [https://gitter.im/crystal-lang/crystal?at=61559327f2cedf67f95be33b]
<FromGitter> <DRVTiny> class itself is an instance of class "Class" :)
<FromGitter> <DRVTiny> But what is method? ;)
<FromGitter> <HertzDevil> but crystal never purports to be "totally oop-driven" in the first place
<FromGitter> <HertzDevil> such a method would not be quite the same thing as ruby's `Method` and `UnboundMethod`, as we have overloading
Volk has quit [Remote host closed the connection]
<FromGitter> <HertzDevil> in ruby it's even more cumbersome as you have to do `x.method(:f)` instead of `->x.f`
<FromGitter> <postmodern:matrix.org> er I meant unicode codepoints that do not map any visible character, but instead get printed as that square with the numbers in it. For example codepoint 888 or `͸`. Appears that `888.chr.control?` returns `false`, so I guess control only covers explicit control characters.
postmodern has joined #crystal-lang
<postmodern> why can't you define a range of Chars in macros?
<FromGitter> <jwaldrip:matrix.org> Any idea why generating a sha takes significantly more time on mac than it does in a dockerized version of crystal?
<FromGitter> <asterite> postmodern: because I didn't think someone would need that
<postmodern> got another one for you
<postmodern> why doesn't '☃' =~ /[[:print:]]/ match?
<postmodern> aka the unicode snowman character for those not using utf8 aware IRC clients
<FromGitter> <asterite> is that a string or a char?
<FromGitter> <asterite> it would only work for strings, char doesn't override `=~`
<postmodern> oh damn
<postmodern> to_s'ing the char doesn't seem to work. https://carc.in/#/r/bzbc
<FromGitter> <asterite> strange, maybe it's a pcre thing
<FromGitter> <asterite> "If the PCRE_UCP option is set, the ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6155e61038377967f427e303]
<FromGitter> <asterite> Maybe we are not passing an option...
<FromGitter> <asterite> Yup, that's it
<FromGitter> <asterite> Could you report a bug? Mentioning that we need to use `PCRE_UCP` when compiling regexes (maybe when matching too, I don't know)
<postmodern> done
SamantazFox has quit [Killed (NickServ (GHOST command used by SamantazFox_))]
SamantazFox_ has joined #crystal-lang
dostoyev1ky2 has joined #crystal-lang
Starfoxxes has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
Vexatos_ has joined #crystal-lang
Starfoxxes has joined #crystal-lang
Vexatos has quit [Ping timeout: 265 seconds]
repo1 has joined #crystal-lang
repo has quit [Ping timeout: 265 seconds]
human_g33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 265 seconds]
dostoyev1ky2 has quit [Quit: leaving]
dostoyevsky2 has joined #crystal-lang
postmodern has quit [Read error: Connection reset by peer]
DeBot has quit [Ping timeout: 246 seconds]
straight-shoota has quit [Ping timeout: 260 seconds]
wolfshappen has quit [Ping timeout: 252 seconds]
jhass has quit [Ping timeout: 264 seconds]
brw has quit [Ping timeout: 268 seconds]
brw has joined #crystal-lang
DeBot has joined #crystal-lang
wolfshappen has joined #crystal-lang
jhass has joined #crystal-lang
straight-shoota has joined #crystal-lang
ur5us has joined #crystal-lang
notzmv has quit [Ping timeout: 250 seconds]
notzmv has joined #crystal-lang
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has joined #crystal-lang
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
notzmv has quit [Read error: Connection reset by peer]
notzmv has joined #crystal-lang
Volk has quit [Quit: See you next time!]
xyhuvud has quit [Remote host closed the connection]
yxhuvud has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
r0bby is now known as r0bby[m]
r0bby[m] is now known as r0bby
ur5us has joined #crystal-lang