ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.0 | 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
_whitelogger has joined #crystal-lang
JuanMiguel has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
JuanMiguel has quit [Quit: This computer has gone to sleep]
sorcus has quit [Ping timeout: 272 seconds]
sorcus has joined #crystal-lang
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Quit: This computer has gone to sleep]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
JuanMiguel has joined #crystal-lang
_ht has joined #crystal-lang
alexherbo2 has joined #crystal-lang
JuanMiguel has quit [Quit: This computer has gone to sleep]
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Client Quit]
_ht has quit [Quit: _ht]
<FromGitter> <vlazar> @watzon I've been there. You can workaround it https://github.com/crystal-lang/crystal/blob/master/scripts/unicode_data.ecr#L133-L143
<FromGitter> <j8r> @asterite right, I can open an issue if it does not already exist
<FromGitter> <j8r> @anykeyh I prefer @stronny solution - simpler, with no macros
<FromGitter> <j8r> and no additional public objects/methods created
<FromGitter> <anykeyh> Yep it's simpler
<FromGitter> <anykeyh> Macro is a great tool ( until you use it ). Haha
<FromGitter> <stronny> @watzon you open("rw") { read(); rewind(); write() } something something?
postmodern has quit [Quit: Leaving]
<FromGitter> <jwoertink> Is there a way to have something call before / after every method is ran? I'm thinking from a profiling aspect where I want to see an overview of my app, and see what methods take the most memory / time to run
<FromGitter> <Blacksmoke16> wrap stuff in a block?
<FromGitter> <jwoertink> Well, I want to know the entire application, so wrapping every method individually would be super cumbersome... but maybe that's the only way?
<FromGitter> <Blacksmoke16> probably?
<FromGitter> <jwoertink> sounds like time for a macro! πŸ˜‚
<FromGitter> <Blacksmoke16> could maybe try out https://github.com/plasma-umass/coz with https://github.com/RX14/coz.cr
<FromGitter> <jwoertink> oh, interesting
<FromGitter> <Blacksmoke16> however iirc w/o that debugger PR, debug info is kinda meh so dont think it'll be *that*useful atm
<FromGitter> <jwoertink> ah right... I haven't tried that fork out yet
<FromGitter> <watzon> @vlazar left it running all night lol, still didn't compile
<FromGitter> <watzon> So the issue is in creating a large array at compile time I guess. I was doing `{{ read_file("foo.txt").split('\n') }}`
<FromGitter> <watzon> Changed it to `{{ read_file("foo.txt") }}.split('\n')` and it compiled in seconds
<FromGitter> <dscottboggs_gitlab> > that debugger PR ⏎ ⏎ πŸ‘€ *What debugger PR?!?!*
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16
<FromGitter> <vlazar> @watzon If you worry about performance of loading data why not use https://github.com/crystal-community/msgpack-crystal ? It's really fast.
<FromGitter> <dscottboggs_gitlab> @watzon woah that sounds like a bug
<FromGitter> <watzon> This project is way too small to warrant setting up msgpack
<FromGitter> <Blacksmoke16> @dscottboggs_gitlab https://github.com/crystal-lang/crystal/pull/8538
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 holy shit I'm so excited, this changes so much
<FromGitter> <watzon> I know this has been asked and I can't remember the answer. Custom compile time flags. Can we look for them?
<FromGitter> <dscottboggs_gitlab> yes
<FromGitter> <watzon> Como?
<FromGitter> <watzon> How? Lol
<FromGitter> <dscottboggs_gitlab> `{% flag? :flagname %} # => true`
<FromGitter> <dscottboggs_gitlab> `crystal build -dflagname`
<FromGitter> <watzon> Ok cool, wasn't sure about that
<FromGitter> <dscottboggs_gitlab> yup, it's all over the stdlib and compiler
<FromGitter> <dscottboggs_gitlab> actually I made a mistake
<FromGitter> <watzon> @Blacksmoke16 what all is that patch going to change?
<FromGitter> <watzon> I don't know much about DWARF and the inner workings of LLVM yet
<FromGitter> <dscottboggs_gitlab> I mean, LLDB/GDB will actually work with crystal
<FromGitter> <dscottboggs_gitlab> you'll be able to single-step through crystal code with contextually-present variables available for inspection
<FromGitter> <watzon> Ahhh yeah, that will change things a lot
<FromGitter> <dscottboggs_gitlab> VSCode support will come shortly thereafter, I'm sure
<FromGitter> <dscottboggs_gitlab> πŸ˜€
<FromGitter> <watzon> Hmm
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e63e26395b8ff0bbf9eda82]
<FromGitter> <watzon> I have them all installed, what the fuck is going on
<FromGitter> <watzon> Ahh crap, arch packages don't generally ship with static libraries
<FromGitter> <Blacksmoke16> cant just use the alpine image?
<FromGitter> <watzon> Probably could actually. Do you have an example of a dockerfile that's already set up to compile a project?
<FromGitter> <Blacksmoke16> `docker run --rm -it -v $PWD:/workspace -w /workspace crystallang/crystal:0.32.1-alpine crystal build hello-world.cr --release --no-debug --static`
<FromGitter> <ImAHopelessDev_gitlab> `rand(num..num)` is AMAZING
<FromGitter> <tenebrousedge> I dunno. It's inedible, so how amazing can it be?
<FromGitter> <ImAHopelessDev_gitlab> good question
<FromGitter> <watzon> πŸ˜‚
<FromGitter> <watzon> `rand(nom..nom)`
<FromGitter> <tenebrousedge> I think that's what my algorithm on opening the fridge is
<FromGitter> <ImAHopelessDev_gitlab> LOL!
<FromGitter> <ImAHopelessDev_gitlab> now that made me laugh, ty
gangstacat has quit [Quit: Ĝis!]
<FromGitter> <watzon> I can't catch a break
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e63ea8c02dbe022a171ab74]
<FromGitter> <Blacksmoke16> oh moment
<FromGitter> <Blacksmoke16> `--link-flags "$(pkg-config libxml-2.0 --libs --static)"`\
<FromGitter> <Blacksmoke16> try adding that
gangstacat has joined #crystal-lang
<FromGitter> <watzon> Wtf, now it's requesting dependencies I've never seen
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e63ebd080cc7b7924ad15ae]
<FromGitter> <Blacksmoke16> try `--link-flags '$(pkg-config libxml-2.0 --libs --static)'`
<FromGitter> <watzon> Holy fuck it worked haha
JuanMiguel has joined #crystal-lang
<FromGitter> <Blacksmoke16> πŸ‘
JuanMiguel has quit [Quit: This computer has gone to sleep]
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Quit: This computer has gone to sleep]
sorcus has quit [Ping timeout: 240 seconds]
sorcus has joined #crystal-lang
JuanMiguel has joined #crystal-lang
alexherbo27 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo27 is now known as alexherbo2
JuanMiguel has quit [Quit: This computer has gone to sleep]
alexherbo2 has quit [Ping timeout: 255 seconds]
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <andrewc910> Quick question. What makes C 'portable'? Is crystal as portable? Can it be? Why or why not?
<FromGitter> <stronny> Depends on the context. C is the universal language for every CPU arch and every OS there is. It doesn't mean the same program would compile and run unmodified, but the languange is the same.
<FromGitter> <tenebrousedge> C is easy to port, but not necessarily "portable"
<FromGitter> <stronny> Overall the question needs to be more specific, because the word "portable" may mean different things.
alexherbo2 has joined #crystal-lang
<FromGitter> <j8r> Java is more portable
<FromGitter> <j8r> Compile once, run everywhere TM
<FromGitter> <stronny> Think embedded
<FromGitter> <stronny> Java does not run native, first you will have to develop its jre, probably in C lol
<FromGitter> <j8r> @andrewc910 I don't know what's exactly your question, can it be more specific?
<FromGitter> <j8r> Platform support you mean?
<FromGitter> <j8r> Then it is because C is more widely used
<FromGitter> <tenebrousedge> Well, as a high level language it's probably less likely to be as portable as C no matter what the context is
<FromGitter> <stronny> Crystal is as portable as LLVM is
<FromGitter> <j8r> indeed, C is lower level and can be more efficient
<FromGitter> <j8r> For instance micro controllers
<FromGitter> <tenebrousedge> you can make C run on literally anything with enough effort. Crystal is likely to fall short of "literally anything"
<FromGitter> <stronny> "make C run" sure, if you write your own compiler
<FromGitter> <stronny> brainfuck is much simpler though
<FromGitter> <stronny> but as much less useful, so there is potential, but not enough effort
<FromGitter> <tenebrousedge> this is probably all true
dwdv has joined #crystal-lang
<FromGitter> <andrewc910> Thanks for all the input! I'm sorry I can't make it more specific. I hear the word portable in Arduino and several other places.
<FromGitter> <andrewc910> I just didn't know what it meant.
<FromGitter> <Daniel-Worrall> You know what's better than Java portability? Webassembly :^)
<FromGitter> <stronny> in Arduino case it's probably about CPU architectures other than amd64
<FromGitter> <andrewc910> So c is portable because it can run on almost every machine? It's not about size? I figured portable meant the compiler/language was small.
<FromGitter> <stronny> it means that for any given arch probably at least one compiler exists
<FromGitter> <andrewc910> Can you even compare haha portability to webassembly? Are they comparable? :O
<FromGitter> <andrewc910> Got it! So crystal is not portable because it works on Linux and mac and that's it?
<FromGitter> <stronny> linux and mac are not CPU architectures
<FromGitter> <stronny> try compiling Crystal for itanium or mips
<FromGitter> <stronny> maybe it's even possible, idk
<FromGitter> <stronny> no it's not actually
<FromGitter> <stronny> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e642952145f4d695628b56b]
<FromGitter> <stronny> and that's it
olbat has quit [Remote host closed the connection]
<FromGitter> <andrewc910> So what makes C able to compile on any architecture? What's holding crystal back from essentially universal compilation?
<FromGitter> <stronny> the work of people that made it possible?
<FromGitter> <andrewc910> Do you have to write an architectural compliant compiler for each one?
<FromGitter> <stronny> of course
<FromGitter> <tenebrousedge> C is a fairly low-level language. It's been compared to a "generic assembly language"
<FromGitter> <andrewc910> Is crystal not that low? I thought compiled languages were as low as you can go before ASM? Even as a compiled language, there are levels(ie crystal is higher than c?)
<FromGitter> <stronny> that's a nuanced question
<FromGitter> <andrewc910> So C is universal because hundreds of compilers have been made? Crystal theoretically could be if people created compilers for each architecture?
<FromGitter> <andrewc910> How so?
<FromGitter> <andrewc910> Sorry if this is really basic. I've only worked with ruby and js. This is all new to me.
<FromGitter> <stronny> Crystal does link native binaries, but it has a substantial amount of "prelude" that goes with it
early has quit [Quit: Leaving]
<FromGitter> <tenebrousedge> C is something like the least complex useful language. It doesn't take much to implement it, or to write a compiler that implements it
<FromGitter> <andrewc910> Crystal is more complex than c?
<FromGitter> <stronny> way more
<FromGitter> <andrewc910> What do you mean by "links native binaries_?
<FromGitter> <stronny> I can't answer in small amount of text sorry
<FromGitter> <andrewc910> What makes it more complex on a technical level? It just has a larger stdlib thus the compiler needs to know more/do more work?
<FromGitter> <stronny> fibers for one
<FromGitter> <tenebrousedge> that's more-or-less the case, yes
<FromGitter> <stronny> event loop for the other
<FromGitter> <tenebrousedge> garbage collection is a big one
<FromGitter> <stronny> that too yes
early has joined #crystal-lang
<FromGitter> <andrewc910> Crystal handles memory for us while c doesn't? Because of that, the C compiler expects you(the programmer) to take care of that which means a simpler compiler?
<FromGitter> <andrewc910> C isn't multithreaded? Or it can be with a lot of work?
<FromGitter> <stronny> not going down tha rabbit hole that's a valid statement
<FromGitter> <stronny> threads have nothing to do with language
<FromGitter> <andrewc910> So why do fibers make the compilation more complex?
<FromGitter> <andrewc910> Btw, thanks for all the input! I really appreciate it 😁
<FromGitter> <stronny> fibers have nothing to do with threads ;)
<FromGitter> <andrewc910> Hmmm, il lhave to read about fibers than
<FromGitter> <andrewc910> Thought fibers == threads but I guess that's wrong
<FromGitter> <tenebrousedge> fibers and garbage collection tend to be complex in ways that are less portable than e.g. integers
<FromGitter> <stronny> in crystal fibers work by switching a stack pointer
<FromGitter> <stronny> in a nutshell
<FromGitter> <stronny> threads live in kernel
<FromGitter> <andrewc910> I don't see how threads & garbage collection are comparable to integers. I'll have to read about this more
<FromGitter> <stronny> they aren't, the example is integers are easier to implement portably
<FromGitter> <andrewc910> Will also look up stack pointer.
alexherbo2 has quit [Ping timeout: 258 seconds]
<FromGitter> <andrewc910> Ohhh! That makes more sense
<FromGitter> <stronny> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e642d97145f4d695628bceb]
<FromGitter> <stronny> that's the magic
<FromGitter> <andrewc910> That's the fiber magic?
<FromGitter> <stronny> yes. coming from ruby and js that's indeed a bunch to take on
<FromGitter> <andrewc910> Fun fact, I can actually read some of that. Pokemon Ron hacking ftw!
<FromGitter> <andrewc910> But okay I'll make sure to understand this method. I'll look up something later 😁
<FromGitter> <stronny> you only need to do that if for some special expertise
<FromGitter> <andrewc910> So all in all, crystal isn't aiming to be C? Crystal is more complex and will hopefully work on most major architectures but will never reach the portability of c? Is that right?
<FromGitter> <stronny> if you need C you use C
<FromGitter> <stronny> you use Crystal if you *don't* need C
<FromGitter> <andrewc910> Sad face. Hoping crystal would eventually be universal :/
<FromGitter> <stronny> that would never come to pass
<FromGitter> <tenebrousedge> Crystal is very much not trying to be a replacement for C
<FromGitter> <stronny> luckily you don't need C that often
<FromGitter> <andrewc910> So what is crystal trying to achieve? Faster ruby? Because it feels like most work goes into HTTP
<FromGitter> <tenebrousedge> high-level languages tend to be more productive. Low-level languages are more flexible. There's nothing wrong with either
<FromGitter> <tenebrousedge> HTTP is one of the fastest paths to a user interface
<FromGitter> <stronny> that's for everyone to decide on their own
<FromGitter> <stronny> for me that's static analysis and simpler deployment
<FromGitter> <tenebrousedge> I like the speed of Crystal, and I like not having `NoMethodError` in production
<FromGitter> <stronny> well you can have that in Crystal actually
<FromGitter> <stronny> but not as often
<FromGitter> <andrewc910> @tenebrousedge yeah I know you see that error as I see you in the rails gutter lol
<FromGitter> <tenebrousedge> only at compile time. All methods have to exist at runtime
<FromGitter> <andrewc910> Luckily I haven't seen that error in crystal
<FromGitter> <stronny> you can even have that in C with fptrs
<FromGitter> <andrewc910> "simpler deployment" what makes crystal simpler to deploy than what language you typically deploy in?
<FromGitter> <stronny> `my_proc.call` and there you go
<FromGitter> <stronny> you only need the compiled binary and the dlls, you don't need the runtime and every gem/npm dependency
<FromGitter> <stronny> dlls live in the system repo by the way, you don't vendor them either
<FromGitter> <andrewc910> Well dart, although can be used for backend, is used for frontend(flutter). Ruby is used with rails and other frameworks but let's be real, typically rails. Js is used for frontend/backend web. C++ for native desktop applications. Does crystal have an aim or are we still figuring that out?
<FromGitter> <andrewc910> That's why I asked the goal of crystal.
<FromGitter> <andrewc910> While most languages can do a lot, most languages are typically used for a very specific purpose.
<FromGitter> <stronny> that's a naive way to look at things
<FromGitter> <stronny> from where I stand Crystal is cool for client-side programs that finish rather quickly
early has quit [Ping timeout: 255 seconds]
<FromGitter> <stronny> something like API clients or system utilities
<FromGitter> <stronny> I'm a minority though
<FromGitter> <andrewc910> What makes it naive? As a beginner, I seems like a very specific language used for a specific purpose most of the time. Most of time. Most Linux applications are c++(except fucking slack), most Android apps are java, mac is swift, web servers are obviously anything from c# to ruby.
<FromGitter> <stronny> don't take it as an attack but much to learn have you yet =)
<FromGitter> <andrewc910> If I'm wrong, I am wrong. Just see most languages used for one specific thing. Tbh, really hoping crystal doesn't become a one trick http pony.
<FromGitter> <stronny> by the way `pony` looks very promising
<FromGitter> <andrewc910> Hence why I am asking questions! :) Would never take is as an attack...unless you literally attack me xD
<FromGitter> <andrewc910> Pony is a language?
<FromGitter> <stronny> yep
<FromGitter> <andrewc910> Of course it is.
<FromGitter> <andrewc910> I'll stick to ruby right now πŸ˜‚
<FromGitter> <stronny> ruby is fine
<FromGitter> <andrewc910> Oh but can you atleast explain why that thought process is wrong? If not, no worries
<FromGitter> <stronny> let's go through the list again
<FromGitter> <andrewc910> In response to "that's a naive way to look at things"
<FromGitter> <stronny> especially that "C++ for native desktop applications"
<FromGitter> <andrewc910> Is it used in other areas?
<FromGitter> <stronny> very much so
<FromGitter> <andrewc910> That makes me sad. Idk c++ but Reddit has made me not want to know c++ :)
<FromGitter> <stronny> c++ is a disaster
<FromGitter> <andrewc910> Where else is it used?
<FromGitter> <stronny> a bit dated but still very entertaining read https://yosefk.com/c++fqa/picture.html
<FromGitter> <stronny> everywhere, name a field there's a ton of ++ code there
<FromGitter> <stronny> even embedded and kernel
<FromGitter> <stronny> even web services
<FromGitter> <andrewc910> Hmm, I guess I need to expand my knowledge of fields. All I can think of is desktop, mobile and web. I'm gonna take a wild guess and say there is more than those 3.
<FromGitter> <stronny> that's what I meant by naive =)
<FromGitter> <andrewc910> I know c++ is used quite a bit in kernels. Tried looking at zircon/fuchisa with little success
<FromGitter> <andrewc910> What's embedded?
<FromGitter> <stronny> think pebble watch
<FromGitter> <andrewc910> Are all smart watches embedded?
<FromGitter> <stronny> no
<FromGitter> <stronny> most are just android/ios
<FromGitter> <stronny> basically you have a 33MHz and 32K ram
<FromGitter> <stronny> that's embedded
<FromGitter> <andrewc910> So embedded is 90s computers is small devices?
<FromGitter> <stronny> yes, small chips
<FromGitter> <andrewc910> Sorry, realistically embedded is just very small computers?
early has joined #crystal-lang
<FromGitter> <andrewc910> Arduino technically embedded?
<FromGitter> <stronny> probably, but sometimes these aren't even computers, just DSPs or special chips
<FromGitter> <stronny> that's beyond my knowledge really, I can't tell you much specifics
<FromGitter> <andrewc910> Hmm I'll have to look those up
<FromGitter> <andrewc910> Thank you for the info! I have plenty to look up! I really appreciate the information ☺️
<FromGitter> <stronny> you are welcome
<FromGitter> <andrewc910> no worries, I was hoping for a general convo like this to get some research topics going. This was perfect! Thank you 😁
<FromGitter> <stronny> πŸ‘
<FromGitter> <stronny> no better way to start than with "Quick question." =)
<FromGitter> <andrewc910> Yeah definitely not as quick as a thought. But thanks! I really do appreciate the info :)