jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
deavmi has quit [Ping timeout: 256 seconds]
deavmi has joined #crystal-lang
rocx has joined #crystal-lang
_whitelogger has joined #crystal-lang
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 264 seconds]
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 256 seconds]
<postmodern> is there something like Iterator, but allows for random access?
rocx has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> example?
postmodern has quit [Read error: Connection reset by peer]
postmodern has joined #crystal-lang
rocx has joined #crystal-lang
<FromGitter> <nolyoi> anyone able to help me with this json error? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0e7e8e343f5d69494ea354]
<FromGitter> <Blacksmoke16> did you require json?
<FromGitter> <nolyoi> yes
<FromGitter> <Blacksmoke16> did you `include JSON::Serializable` into your `CrystalChain::Block`?
<FromGitter> <nolyoi> yessir
<FromGitter> <Blacksmoke16> can you share more code?
<FromGitter> <nolyoi> crystal_chain.cr ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0e80121cc04369596391a9]
<FromGitter> <Blacksmoke16> `Transaction` does that include serializable too?
<FromGitter> <nolyoi> server.cr ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0e80b954d58c013a42ae18]
rocx has quit [Ping timeout: 260 seconds]
<FromGitter> <nolyoi> > `Transaction` does that include serializable too?
<FromGitter> <nolyoi> ah that was it. *facepalms*
<FromGitter> <Blacksmoke16> strange error tho, i would have thought it would have pointed to that
DTZUZU_ is now known as DTZUZU
<FromGitter> <nolyoi> yeah not sure. im kind of running through a tutorial and very new to crystal.
<FromGitter> <nolyoi> could someone possibly explain these macros to me? why would you ever not use Id? Also it states "You can invoke a fixed subset of methods on AST nodes at compile-time. " what exactly does the fixed subset mean? ⏎ ⏎ ```macro define_method(name, content) ⏎ def {{name.id}} ⏎ {{content}} ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5f0e9b87343f5d69494ee8b3]
<FromGitter> <naqvis> `id` is used when you need an identifier out of a StringLiteral, SymbolLiteral, Var or Call. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0e9d909c75aa256b3f8bb8]
cloaked1 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
alexherbo2 has joined #crystal-lang
ua has quit [Read error: Connection reset by peer]
ua_ has joined #crystal-lang
Jenz has joined #crystal-lang
* Jenz o/
<Jenz> How does it make sense for modules to have class variables? https://play.crystal-lang.org/#/r/9f0e
_whitelogger has joined #crystal-lang
<yxhuvud> Are you complaining about the concept of storing data in a module or just about the naming that is exposed?
sagax has quit [Quit: Konversation terminated!]
<FromGitter> <j8r> Using class variable makes testing harder
<FromGitter> <j8r> Sometimes they are practical and cannot easily be avoided, so in this case I prefer having a single class var which holds a struct/class
<FromGitter> <j8r> for example, application's configuration
sagax has joined #crystal-lang
<yxhuvud> Yes, it can certainly be argued they are usually anti-patterns. But I didn't get the impression that was the question.
<FromGitter> <j8r> for class vars in modules vs objects, that kind feel weird but why not - that's a namespace like another
<FromGitter> <j8r> class vars does not need to instantiate an object, so kind of make sense.
alexherbo2 has quit [Ping timeout: 272 seconds]
<raz> i have a feeling we should feed the crystal codebase to GPT-3 and see what comes out
alexherbo2 has joined #crystal-lang
_whitelogger has joined #crystal-lang
alexherbo2 has joined #crystal-lang
rocx has joined #crystal-lang
<FromGitter> <naqvis> module is `Class` in disguise with a purpose for namespacing and partial types implementations for mixin usages. ⏎ `pp typeof(Foo) # => Class`
Jenz has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
<alexherbo2> what is the shell command equivalent to `Crypto::Bcrypt::Password.create("my_password").to_s`?
<alexherbo2> looks complicated
<alexherbo2> I hopped there were just a posix tool combination for it
<FromGitter> <plambert> I don’t know that POSIX specifies much detail on passwords and their generation. bcrypt is probably newer than POSIX?
duane has quit [Read error: Connection reset by peer]
<oprypin> plambert, i dont think that was the point
rocx has quit [Read error: Connection reset by peer]
duane has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 272 seconds]
deavmi has quit [Read error: No route to host]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Client Quit]
rocx has joined #crystal-lang
skrzyp1 is now known as skrzyp
rocx has quit [Ping timeout: 260 seconds]
rocx has joined #crystal-lang
alexherbo2 has joined #crystal-lang
blassin has joined #crystal-lang
<blassin> hello everyone!
<blassin> I have a weird issue with duplicate logging, not sure what I'm doing wrong
<blassin> example:
<blassin> 2020-07-15T18:25:41.909097Z INFO - ContentRenderer: rendered page 1/1 to output/pages/about/index.html I [ContentRenderer] -- rendered page 1/1 to output/pages/about/index.html
<blassin> that's 2 lines
<blassin> I have a customized Logger backend, but it seems like the default one is still active and mirrors all my Log.x calls?
<FromGitter> <Blacksmoke16> can you share some of the code?
<blassin> this is what I use for setting up the log https://carc.in/#/r/9f1p
<blassin> I call this as soon as I know from the CLI if it's debug mode or not
f1refly has quit [Quit: bye fags]
<FromGitter> <Blacksmoke16> try calling `Log::Builder.clear` before your binding
f1refly has joined #crystal-lang
<FromGitter> <Blacksmoke16> to get rid of the default ones
<blassin> undefined method 'clear' for Log::Builder.class
<blassin> ok, using `Log.builder.clear`
<blassin> that fixes it!
<blassin> I assumed the bind would do it for me :facepalm:
<blassin> thanks
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Log.html#setup(*,builder:Log::Builder=Log.builder,&)-class-method
<FromGitter> <Blacksmoke16> could also use that
<FromGitter> <Blacksmoke16> or one of the other setup methods
<blassin> not sure how to do the same with a setup call
<blassin> what's the `*` in - Log.setup(sources : String = "*", level : Log::Severity = Log::Severity::Info, backend : Log::Backend = IOBackend.new, *, builder : Log::Builder = Log.builder) ?
<FromGitter> <Blacksmoke16> `*` just makes it so any argument after it have to be supplied as named arguments
<FromGitter> <Blacksmoke16> but you would use it like, instead of
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0f51480d37916fda790bd0]
f1refly has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0f515c343f5d694951070d]
<blassin> ok, so `::Log.setup("*", Log::Severity::Debug, backend, builder: Log.builder)`
<blassin> got it
<FromGitter> <Blacksmoke16> essentially the same as doing what you were and calling `::Log.builder.clear` tho
<FromGitter> <sardaukar> this reads better
<FromGitter> <sardaukar> thanks!
<FromGitter> <Blacksmoke16> blassin: not quite
f1refly has joined #crystal-lang
<blassin> ?
<FromGitter> <Blacksmoke16> nvm
rocx has quit [Remote host closed the connection]
rocx has joined #crystal-lang
deavmi has joined #crystal-lang
blassin has quit [Remote host closed the connection]
duane has quit [Ping timeout: 272 seconds]
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 260 seconds]
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
rocx has quit [Ping timeout: 260 seconds]
<FromGitter> <j8r> there is an issue with the API docs, `extend self` is not taken into account in modules
<FromGitter> <j8r> the methods are marked as instance `#method` instead of class `.methods`
<FromGitter> <tenebrousedge> example?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f0f76511c84e5557928d87f]
<FromGitter> <j8r> yep :+1
<FromGitter> <Blacksmoke16> should add both `.bar` and `#bar`
<FromGitter> <Blacksmoke16> er just the former
<FromGitter> <j8r> ha?
<FromGitter> <tenebrousedge> I understand what the problem is, but is this happening with some public doc somewhere?
<FromGitter> <j8r> both can be correct
<FromGitter> <j8r> Mine :P
<FromGitter> <j8r> I guess I have to add `self.` to all methods to disambiguate :/
<FromGitter> <Blacksmoke16> imo you'd be better off adding `self.` and prob just not using `extend self` at all
<FromGitter> <j8r> That was to gaining time, like I have 34 methods haha
<FromGitter> <j8r> ok, let's do it - that's just once anyway
<FromGitter> <j8r> For the reference, the shard is https://j8r.github.io/crystalizer/Crystalizer.html, where free variables are heavily used
f1refly has quit [Ping timeout: 260 seconds]
duane has joined #crystal-lang
f1refly has joined #crystal-lang
f1refly has quit [Quit: bye fags]
f1refly has joined #crystal-lang
Vexatoast has joined #crystal-lang
f1refly has quit [Client Quit]
f1refly has joined #crystal-lang
Vexatos has quit [Ping timeout: 258 seconds]
Vexatoast has quit [Client Quit]
Vexatos has joined #crystal-lang
rocx has joined #crystal-lang
duane has quit [Ping timeout: 272 seconds]
alexherbo2 has quit [Ping timeout: 256 seconds]
postmodern has joined #crystal-lang
f1refly has quit [Ping timeout: 260 seconds]
f1refly has joined #crystal-lang
_whitelogger has joined #crystal-lang