<FromGitter>
<Blacksmoke16> and Tar wasnt in the docs
<FromGitter>
<Blacksmoke16> oh
<FromGitter>
<Blacksmoke16> try deleting the docs dir and redo `crystal docs`
<FromGitter>
<Blacksmoke16> i dont think it cleans up files that you add nodoc to that are no longer used
<FromGitter>
<watzon> It usually cleans them, but it could have fucked up somewhere.
<FromGitter>
<watzon> Are there any resources anywhere for including rust in a Crystal project? I imagine it's similar to how you'd do it with C++.
<FromGitter>
<mwlang> That did it!
<FromGitter>
<Blacksmoke16> π
<FromGitter>
<mwlang> well, the project has a ways to go, but it's beginning to take shape: https://github.com/mwlang/binance Comments, suggestions for improving definitely welcome
<FromGitter>
<mwlang> esp. as this is my first Crystal OSS project and coming from a Ruby background.
<FromGitter>
<mwlang> documentation is gonna take some work, but I'm definitely trying to organize the code around what will generate organized docs.
<FromGitter>
<mwlang> so far, not entirely happy with that aspect of things, but imagine I just need to get some practice under my belt.
<FromGitter>
<mwlang> funny thing: when I first switched from Delphi/Pascal to Ruby, I implemented an Enumerator gem and Rubyist thought I was nuts for wanting Enums in Ruby.
<FromGitter>
<Blacksmoke16> is that not something that exists already?
<FromGitter>
<mwlang> well, not really...Rubyists use symbols and hashes for everything frickin' thing.
<FromGitter>
<Blacksmoke16> :S fair enough
<FromGitter>
<mwlang> so I'm actually "unlearning" some habits I picked up in Ruby and recovering old long-lost habits from Delphi days.
<FromGitter>
<Blacksmoke16> hehe, symbols might get removed eventually, so id just use strings
<FromGitter>
<mwlang> one thing I did in this binance project was use classes, not structs for the incoming data. I'm not sure quite what the advantages of one over the other is, but I definitely had less hassles getting classes to work like I was thinking in the moment.
<FromGitter>
<Blacksmoke16> classes are passed by reference while structs are value
<FromGitter>
<mwlang> which means, if I take a struct and try to set it's property in some method call, I really didn't set it, did I?
<FromGitter>
<Blacksmoke16> more like if you have an obj from a struct, and you pass that obj to a method that edits it, the original obj you passed isnt going to be changed, only the one within the method
<FromGitter>
<Blacksmoke16> while a class would edit the original
<FromGitter>
<Blacksmoke16> are some examples in those links, id suggest reading over them first
<FromGitter>
<Blacksmoke16> rule of thumb is if the data is immutable, structs are better
<FromGitter>
<Blacksmoke16> but if you want to be able to pass an obj around and have it all editing the same obj, classes
<FromGitter>
<mwlang> yeah, that's just how I'm used to thinking of the programming solutions right now on account of my Ruby background.
<FromGitter>
<mwlang> with working specs, I can try to redo as structs and see if it all works.
<FromGitter>
<Blacksmoke16> π
<FromGitter>
<Blacksmoke16> not a fan of using a spec shard tho
<FromGitter>
<Blacksmoke16> just adds something else that could go unmaintained, block your CI, make it that much harder for people to contribute
<FromGitter>
<mwlang> oh yeah, just remembered where specifically I struggled...if I make the core class ServerResponse a struct and attempt to inherit to extend: "can't extend non-abstract struct Binance::Responses::ServerResponse"
<FromGitter>
<mwlang> you mean spec2?
<FromGitter>
<Blacksmoke16> yea
<FromGitter>
<Blacksmoke16> just make your parent struct abstract?
<FromGitter>
<mwlang> well, that got me further along.
<FromGitter>
<mwlang> for spec2, I may remove it as you suggest. It's not actively maintained and I had to tweak and extend some of it for what I wanted to do as well...and that raises another point...I just realized the ```lib``` folder isn't checked into the repo, so my changes to any dependent shards aren't carried along with the project.
<FromGitter>
<Blacksmoke16> mhm
<FromGitter>
<Blacksmoke16> would have to fork it and use your fork as a dep
<FromGitter>
<mwlang> another vote for casting it out altogether. :-/
<FromGitter>
<Blacksmoke16> i kinda like the simplicity of the stdlib module
<FromGitter>
<mwlang> I'm just used to some of the extended functionality of Ruby's rspec. The tools like "let", "let!", "subject", "its" and so on really help to DRY up one's specs.
<FromGitter>
<mwlang> but I think also, there's less specs to write for Crystal programs because the compiler is catching a lot of the stuff one would often write specs for in Ruby.
<FromGitter>
<watzon> Why would symbols be removed?
<FromGitter>
<Blacksmoke16> they dont really do anything diff than strings
<FromGitter>
<Blacksmoke16> if they get removed it would be like `x = :foo`
<FromGitter>
<watzon> I get that they don't serve the same function as Ruby's symbols, but they still serve a purpose don't they?
<FromGitter>
<Blacksmoke16> there isnt really a benefit instead of `x = "foo"`
<FromGitter>
<Blacksmoke16> they would be exclusive to autocasting enum members afaik
<FromGitter>
<Blacksmoke16> i.e. if you have an enum like
<FromGitter>
<renich> The keys array should be: `["hostname", "bios_version", ...]`. The values array should be the same.
<FromGitter>
<renich> :S
<FromGitter>
<watzon> @renich ideally when asking for help try and shrink your problem down to the minimum code possible that demonstrates your problem
<FromGitter>
<watzon> Makes things a bit easier to figure out
<FromGitter>
<renich> @watzon yeah... I know. It's hard to do that when you don't get macros. I mean, yes, the yaml might be a bit too much...
<FromGitter>
<renich> sorry...
<FromGitter>
<watzon> Yeah try shrinking it as much as you can and I'll take a look
<FromGitter>
<sam0x17> I almost.... *almost* wish there was a way of specifying macros where it's just a normal crystal function that returns a string that is the source code
<FromGitter>
<sam0x17> in Rust I definitely wish that
<FromGitter>
<renich> @watzon OK. Could you help me by making the output that keys gives, be an array in the form of: `[hostname, "bios_vendor", ...]`?
<FromGitter>
<renich> I need the values in the same format as well.
<FromGitter>
<renich> OK
<FromGitter>
<renich> Oh, that might help me much! :D
<FromGitter>
<renich> Ah, but that's ruby. They're not dealing with macros there...
<FromGitter>
<renich> Oh, man. I didn't know yaml was so hard to manage in crystal...
<FromGitter>
<renich> Y really need to get my macro chops going...
<FromGitter>
<Coalpha> Hi all. I've just been looking into crystal and I was wondering if there's any way to declare a variable (and it's type) without assigning to it.
<FromGitter>
<Coalpha> Never mind, just found my answer, must have skipped over some of the book
<FromGitter>
<watzon> @Coalpha you mean just assigning its value as `nil`?
woodruffw has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
<FromGitter>
<renich> Would someone take a look at this? https://play.crystal-lang.org/#/r/6ymt. My problem is in line 64. Basically, I need a way for doing the keys vs i.name comparison. It doesn't work if I remove `"" #`
_whitelogger has joined #crystal-lang
ShalokShalom has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ShalokShalom has joined #crystal-lang
hightower2 has quit [Ping timeout: 252 seconds]
ashirase has quit [Ping timeout: 272 seconds]
ashirase has joined #crystal-lang
<FromGitter>
<j8r> How can I print the Crystal version on my Crystal program?
<FromGitter>
<j8r> without subprocess
alex```` has quit [Ping timeout: 272 seconds]
alex```` has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Raimondi has quit [Quit: WeeChat 2.4: Β‘Chau!]
<FromGitter>
<Val> ``````
<FromGitter>
<Val> Crystal::VERSION
<FromGitter>
<j8r> yes, thanks
<FromGitter>
<j8r> For LLVM, I've done `require "llvm"; LLVM.default_target_triple`
<FromGitter>
<bew> @watzon when you say `Because the program won't compile` in the crystal version of `first_and_last`, I'd suggest to show the compile error right here
<FromGitter>
<Blacksmoke16> @watzon no because that would give the var a type of nil, which in some cases is needed
<FromGitter>
<Blacksmoke16> can do like `@var : Int32` but ofc it has to be given a default value or initialized in the initializer
<FromGitter>
<Blacksmoke16> same idea with local vars as well, just have to assign them before you can use them
_whitelogger has joined #crystal-lang
<FromGitter>
<mwlang> can ```crystal docs``` be leveraged into generating the README.md of the project?
<z64>
not entirely sure how that would work, as currently its the other way around - an existing README.md is used by the docs gen as the main page
<z64>
that said, you can use the generated `docs/index.json` to build whatever you like
alexherbo28 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 248 seconds]
<FromGitter>
<mwlang> ok, I didn't realize the ./README.md was the main page of the docs generated. So, I'll look at that more. Only just now trying to think through documenting the typical README.md that github displays and the embedded comments markups so I'm not writing examples twice.
hightower2 has joined #crystal-lang
alexherbo280 has joined #crystal-lang
alexherbo28 has quit [Ping timeout: 248 seconds]
<FromGitter>
<Blacksmoke16> just have a link in the readme to your api docs?
jeremycw has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alexherbo2801 has joined #crystal-lang
alexherbo280 has quit [Ping timeout: 248 seconds]
Raimondi has quit [Quit: WeeChat 2.4: Β‘Chau!]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
jeremycw has quit [Ping timeout: 272 seconds]
rohitpaulk has quit [Ping timeout: 272 seconds]
laaron has quit [Remote host closed the connection]
alexherbo2801 has quit [Ping timeout: 248 seconds]
<FromGitter>
<kingsleyh> evening - I'm looking for anyone interested in helping out on my Crystal based blockchain platform in any capacity - there will be future rewards available - I'm currently in a fundraising incubator program - so there is a real chance of investment - send me a message if you are remotely interested :) - https://sushichain.io
dragonkh has joined #crystal-lang
<FromGitter>
<drum445> Hello, is there a way to initialise a new class via a macro?
<jhass>
but again, this seems fighting the language and trading compile time for runtime errors
<FromGitter>
<kingsleyh> @wontruefree please feel free to join the Telegram channel on the website and help out if you feel like it :)
<FromGitter>
<kingsleyh> lots of technical challenges in Crystal coming up :)
<FromGitter>
<drum445> @jhass you're probably right, thanks for helping though mate
<FromGitter>
<wontruefree> Thanks for the info I will try and build it tonight
<jhass>
yw :)
Raimondi has joined #crystal-lang
<jhass>
for me a good mindest to approach this stuff is "how would I write this without any magic?" "how would I write this if boilerplate is no concern?" and then "which of the two is the nicer API when I hide the boilerplate with macros?"
<jhass>
and that's also a good way to think about macro usecases "uh, too much typing, let's automate that typing"
<jhass>
try to write macros that produce code you could've written by hand
<FromGitter>
<drum445> Indeed, it does seem strange not to be able to intialize a class from a string
<FromGitter>
<drum445> especially when all the class strings are there to begin with