<RX14>
@watzon depends what you think we mean by "turned off"
<FromGitter>
<watzon> Lol I don't really know. I just get comments from people saying that GC should be optional and I feel like I remember seeing somewhere that it can be disabled at compile time
<RX14>
@watzon we mean by GC turned off, that your memory usage just grows.
<RX14>
forever.
<RX14>
that's what "no GC" means
<RX14>
not Rust
<RX14>
it means you're fucked
<FromGitter>
<watzon> Ahh, so there's no way to handle garbage collection yourself
<FromGitter>
<watzon> Is that planned?
<FromGitter>
<bew> do you mean "make your own GC" ?
<RX14>
the point of having the "no gc" option is ONLY to allow ysbaddaden to work on his new GC out-of-tree
<FromGitter>
<watzon> I see haha. I mean the same way that you'd program in C++ with no GC. Handle memory de-allocation yourself.
<FromGitter>
<watzon> Not that I'd ever want to do that
<RX14>
thing is
<FromGitter>
<watzon> But some people see GC as the evil in the world
<RX14>
in C++ you know what you're allocating
<FromGitter>
<watzon> This is true
<RX14>
well no
<RX14>
let me phrase that a lot better
<RX14>
in Crystal the stdlib is built around GC
<RX14>
we use classes everywhere
<FromGitter>
<watzon> Right
<RX14>
we never deallocate memory manually
<RX14>
so no GC will never work
<RX14>
because you can't use the stdlib
<RX14>
you have to start from scratch
<RX14>
and then is it even really crystal without the crystal stdlib?
<RX14>
you're programming with half of crystal
<FromGitter>
<watzon> So for use to be able to make GC optional we'd need a complete rewrite of the stdlib without GC
<FromGitter>
<watzon> Which isn't going to happen obviously
<FromGitter>
<aisrael> I like how Rust does it with “ownership” and “borrowing”, except that its syntax became extra verbose (and the whole thing a little more complicated) because of that...
<RX14>
that's the limit technically
<FromGitter>
<watzon> I do too
<RX14>
it's not going to happen on a human basis
<RX14>
because the core team won't let it happen
<RX14>
@aisrael as I said earlier it's all about the goal of the language
<RX14>
crystal doesn't aim to be fast
<RX14>
it aims to, in order of importance
<RX14>
1) be safe
<RX14>
2) feel like a dynamic language
<RX14>
3) be fast
<RX14>
thats the goals
<RX14>
rust's goals are different
<RX14>
1) be safe
<RX14>
2) no runtime/gc
<RX14>
3) be fast
<FromGitter>
<watzon> Is @ysbaddaden 's garbage collector being written in C?
<RX14>
yes
<FromGitter>
<aisrael> I understand. Just saying. I wanted to like Rust, but then it started feeling too much like C++
<RX14>
making people install 2 toolchains to compile crystal would be a pain
<RX14>
so you want to work on crystal
<RX14>
oh no
<RX14>
you need to install rust AND the crystal compiler
<RX14>
that sucks
<RX14>
nobody wants that
<RX14>
in 5 years if rust compilers come installed as standard
<RX14>
sure we can use rust
<RX14>
for now? portability and ease of use heavily favours C
jokke has quit [Quit: WeeChat 2.0.1]
<FromGitter>
<watzon> Unfortunately. I'm rooting for Rust and Crystal
<FromGitter>
<watzon> I'd love to live in a world without C++
<RX14>
yeah me too
<FromGitter>
<watzon> Will it ever happen? Probably not
<FromGitter>
<watzon> But a dev can dream
<RX14>
rust's more probable haha
<FromGitter>
<watzon> Definitely haha. Although Crystal would make me happier. Such a beautiful language
<FromGitter>
<watzon> Especially compared to Rust and C++
cremes has joined #crystal-lang
hightower has quit [Ping timeout: 246 seconds]
cremes has quit [Quit: cremes]
cremes has joined #crystal-lang
cremes has quit [Quit: cremes]
cremes has joined #crystal-lang
cremes has quit [Quit: cremes]
DTZUZU has quit [Ping timeout: 252 seconds]
qard has joined #crystal-lang
<FromGitter>
<Dillybob1992> @watzon i did a couple ROT26 rotations today with my users table. worked great! passwords are safely secure
cremes has joined #crystal-lang
cremes has quit [Client Quit]
_whitelogger has joined #crystal-lang
<FromGitter>
<fridgerator> hey
aroaminggeek has joined #crystal-lang
qard has quit [Quit: qard]
DTZUZU has joined #crystal-lang
jnyw has joined #crystal-lang
aroaminggeek has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
ua has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
<FromGitter>
<bararchy> RX14 did you tweet about compiling the compiler for windows ?
hightower has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
hightower has quit [Ping timeout: 252 seconds]
jnyw has quit [Ping timeout: 276 seconds]
<livcd>
Crystal does not aim to be fast ?
<oprypin>
livcd, where did that come from
<livcd>
oprypin: RX14 :)..but taken out of the context of that discussion
<oprypin>
so pls dont take it out of context
<livcd>
oprypin: he said it does not aim to be fast the most important things are 1) safety 2) feeling like dynamic lang 3) being fast
<oprypin>
ok well that's just badly worded even with context "crystal doesn't aim to be fast"
<oprypin>
feel free to ignore that line. i'm sure it was meant as "it's not #1 priority"
<oprypin>
which is expanded upon in the 3-point list
hightower has joined #crystal-lang
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
hightower has quit [Ping timeout: 248 seconds]
jnyw has joined #crystal-lang
<FromGitter>
<asterite> Hmm... Crystal is designed around being able to be fast. But it doesn't always succeed (many memory allocations in some cases). But there's always an (uglier) way to avoid those memory allocations
<FromGitter>
<asterite> And maybe no_gc should be called leak_mode to avoid confusion. Crystal will always have a GC, that will never change
hightower2 has joined #crystal-lang
jnyw has quit [Quit: WeeChat 2.0.1]
hightower3 has quit [Ping timeout: 246 seconds]
<RX14>
Well I've always said that I'd use crystal even if it was the same speed as ruby
<RX14>
I'm glad it's not
<RX14>
But I value the design and safety far far more than the speed
<RX14>
Plus most of our effective speed for io bound applications comes from the concurrency design, not the speed of executing code itself
<RX14>
There are evented io frameworks for ruby that showcase such a speed gain
<FromGitter>
<bramhaag> It says there is no overload with type `IO::ByteIterator(TCPSocket)`, but there is?
<FromGitter>
<drosehn> "leak mode" doesn't sound too scary. Maybe "memory skyrockets mode" or "memory out-of-control mode".
<FromGitter>
<drosehn> @bramhaag At first glance that does seem strange. I think we need to see more of the code. disclaimer: I'm not really awake yet...
<FromGitter>
<bramhaag> https://hastebin.com/ogomulisuy.rb, it works when removing the explicit type hint though so not that big of a deal anymore
<FromGitter>
<sptorin_twitter> Hello to all. Exist some good tutorial or Crystal-Book with examples?
cremes has joined #crystal-lang
Ven`` has joined #crystal-lang
cremes has quit [Quit: cremes]
<FromGitter>
<vrinek> hi, I'm trying to write a `from_json` for an object that gets deserialized from a tuple-like array which looks like `[1455528030,500.0,600.0,510.0,550.0,120.0]` (the `to_json` was easy). Does anyone have some time to lend a hand?
<Papierkorb>
You can shorten later parts to `@low, @high, ... = t[1..-1]`
<sc0per31>
hello. I have a problem. I want to define a variable which contains Time.now in the first line of my program. And I want to use this variable then in my initialize() in my class. (thats the point where the actuall program starts). But it says the variable I defined in the first line of the program undefined when I use it in the initialize(). What should I do? Im trying to measure the time how long it has taken to start.
<Papierkorb>
sc0per31: Use a constant
<sc0per31>
huh? Why is a constant working?
<RX14>
because they have different scopes
<sc0per31>
and what if i want to change the value? Is there no way then?
<RX14>
top-level constants are available anywhere
<Papierkorb>
Constants are runtime constant, not necessarily compile-time constant.
<RX14>
top-level lcoa vars are available only in the top-level
<RX14>
local vars*
<sc0per31>
so theres no way if I want to change this value? thats really bad.. i hope crystal will change that. So that you can define instance variables and class variables at top level
<sc0per31>
because limitation are never good for a dev
<Papierkorb>
That'll hopefully never change.
<Papierkorb>
Because writing `class_property` in any class is really easy.
<sc0per31>
you mean its possible with class_property? I will look at it
<Papierkorb>
vrinek, oh yeah right.
<sc0per31>
Papierkorb: hm it doesnt looks like you can use top level vars in classes with "property"
<Papierkorb>
No, cause that'd be weird.
<Papierkorb>
You can't even do that in Ruby
<sc0per31>
ah.. so its impossible.. thats sad man
<Papierkorb>
> "in any class"
<Papierkorb>
toplevel is not a class.
<sc0per31>
i know
<sc0per31>
it would be really weird if toplevel is a class
<Yxhuvud>
Why?
<Yxhuvud>
It is a design choice just as any other. I wouldn't find it weird, just different to the current choice.
<FromGitter>
<asterite> Define a class, use class_property and you are done. In Ruby you would use a global variable. Also, to measure elapsed time, use Benchmark, or at_exit (and there you can use the top level variable because it's captured in the block)
<FromGitter>
<asterite> There are many ways to do what you want
<dragonkh>
hey - what is Crystals version of string append from Ruby - e.g. name = "dragon" ; name << "kh"
<dragonkh>
I gues name = name + "kh" - works just fine
<Yxhuvud>
strings in crystal are immutable, so << is out.
sc0per31 has quit [Ping timeout: 260 seconds]
<dragonkh>
ok thanks
<Papierkorb>
Also see `String.build`
<dragonkh>
I'm converting some ruby to crystal - but stuck again with pack
<dragonkh>
bytes = self.pbkdf2_sha256(password, salt, 1, p * 128 * r) ; b = bytes.unpack("V*")
<dragonkh>
how would I do that in Crystal ?
<Papierkorb>
What is 'V'?
<dragonkh>
V | Integer | 32-bit unsigned, VAX (little-endian) byte order
dragonkh has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
thews has quit [Ping timeout: 264 seconds]
thews has joined #crystal-lang
thews has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<watzon> Sorry @codenoid I'm not understanding your question. Are you asking if you can do what that Python code is doing in Crystal?
<FromGitter>
<watzon> If so the answer is definitely yes. If you want an API similar to Python's Requests library I'd recommend Halite (https://github.com/icyleaf/halite)
<oprypin>
nice
<FromGitter>
<watzon> What's the crystal app that helps with generating bindings for C libraries?
<RX14>
there's like
<RX14>
4
<FromGitter>
<watzon> I can never find it when I need it
<FromGitter>
<watzon> Lol. Well name one or two if you could
<FromGitter>
<watzon> I need some mother loving ffmpeg bindings in Crystal