<FromGitter>
<bajro17> I'm beginner it will help me to understand better crystal
<dragonkh>
me too :)
<dragonkh>
but I've been doing ruby for a long time so I'm finding Crystal is similar enough that conversions are not too bad
<FromGitter>
<bajro17> I dont I use before golang and php (mostly laravel)
<FromGitter>
<bajro17> but I see crystal with so bright future and I like so much how clean syntax is
<FromGitter>
<sdogruyol> hey welcome @bajro17 👍
<FromGitter>
<bajro17> thank you so much Kemal father :D @sdogruyol
<FromGitter>
<sdogruyol> thank you 😄
<FromGitter>
<bajro17> I have also question for you @sdogruyol I'm hopeless few years I search for job with no success and now I decide to search in Turkey if you know any site in Turkey where I can search for job (I know its not topic for here but I see you are so active on gitter)
<FromGitter>
<sdogruyol> where are you from? Why Turkey?
<FromGitter>
<bajro17> I'm from Bosnia
<FromGitter>
<sdogruyol> oh Bosnia, awesome!
<FromGitter>
<sdogruyol> I want to visit there :)
<FromGitter>
<bajro17> Bujrum whenever you want bro
<FromGitter>
<bajro17> so much buildings stay from time of Turkish empire
<FromGitter>
<bajro17> if I learn more about crystal we can even try make some crystal con
<FromGitter>
<sdogruyol> that'd be great 💯
<FromGitter>
<sdogruyol> about Turkis software market, there's not many Ruby jobs around
<FromGitter>
<sdogruyol> Turkish*
<FromGitter>
<bajro17> I will be happy even with laravel or golang
<FromGitter>
<sdogruyol> Lots of PHP though
<FromGitter>
<bajro17> do you still live there?
<FromGitter>
<bajro17> also do you have kemal auto generate auth?
<FromGitter>
<bajro17> because all time I scare about security in my app :D
Papierkorb has quit [Remote host closed the connection]
<FromGitter>
<sdogruyol> ugh, not sure if basic-auth is enough for your needs :)
<FromGitter>
<bajro17> I still than need convert paypal sdk and I will publish my website I will send you message when it be published to you can put also that my website use kemal in production
<FromGitter>
<bajro17> :)
<FromGitter>
<sdogruyol> sure
<FromGitter>
<bajro17> thank you so much
dragonkh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<yxhuvud> no it returns nil if it is empty
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 252 seconds]
<FromGitter>
<vpereira> @yxhuvud thank you
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<FromGitter>
<straight-shoota> Groogy, or backward
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<FromGitter>
<asterite> Time.new should store monotonic, cough, cough
<FromGitter>
<asterite> My guess is that using Time.new to measure elapsed time will happen over and over again
<FromGitter>
<asterite> Too bad Go's designed wasn't liked
<FromGitter>
<marksiemers> Groogy, I think you should add that screenshot (or others) to the github readme.
<Groogy>
for Boleite?
<FromGitter>
<marksiemers> Yeah, or Ego.
<Groogy>
I'll put that up when I got some more content in the project
<Groogy>
so it doesn't look so empty
Papierkorb has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
<FromGitter>
<straight-shoota> @asterite I was under the impression Crystal should be a general purpose application language, not just for webapps... 😕
<RX14>
@asterite I liked go's design
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter>
<asterite> we could always change it later
<FromGitter>
<asterite> Yeah, theoretiaclly crystal is a general purpose programming language, but practically it's not, I think
<FromGitter>
<asterite> Most stuff people do are webapps, and you can see that by the huge amount of "frameworks"
<RX14>
@asterite I don't think it's worth worrying about what most people use it for
<RX14>
I think of crystal as very general-purpose and I don't really think there's any reason to worry about what it's used for in practice
<FromGitter>
<asterite> I know
<RX14>
you don't generally have to tradeoff between usecases I think
<FromGitter>
<asterite> it's just that I can't imagine a running crystal program and a catastrophic change in local location
<FromGitter>
<asterite> It's either a server, which doesn't travel
<FromGitter>
<asterite> A game, maybe? You are playing on a plain
<FromGitter>
<asterite> If Go caches the local time and nobody is complaining about that (I can't find hits in Google) then it seems safe
<RX14>
exactly
<RX14>
I think most programs will cache it
<RX14>
and most users will be very used to changes in /etc/localtime not reflecting until processes are restarted
<RX14>
wither they're in C or in Go or in Crystal
<RX14>
so don't worry about it and tradeoff performance like the rest
<RX14>
but provide an option for some applications to optionally implement spawn { loop { sleep 5; Location.invalidate_cache } }
<RX14>
and then everyone's happy
<FromGitter>
<asterite> Right
<RX14>
@straight-shoota please just implement it as we've asked...
<FromGitter>
<asterite> then we just need to be able to attach attributes to instance vars to control the serialization
<FromGitter>
<asterite> but by default just doing `include JSON::Serializable` will do it, for example inside a `record` block
<FromGitter>
<asterite> Plus it supports inheritance
<RX14>
i'm not really a fan of the whole "include a module to run macros" job
<RX14>
if you're join that why not just have
<RX14>
JSON.serializable
<RX14>
instead of include JSON::Serializable
<RX14>
and it's not overloading one syntax for 2 things?
<FromGitter>
<asterite> what does JSON.serializable do?
<RX14>
it's a macro
<FromGitter>
<asterite> Ah, let me try
<FromGitter>
<asterite> Yeah, it doesn't work
<FromGitter>
<asterite> because you want to generate macro code inside `initialize`
<FromGitter>
<asterite> so you need to start using \{%
<FromGitter>
<asterite> well, `\{%`
<FromGitter>
<asterite> and stuff like that
<FromGitter>
<asterite> so ugly
<RX14>
ugh
<FromGitter>
<asterite> That's why I ended up with that
<FromGitter>
<asterite> In fact, it almost works by change because macros inside methods are only computed when the method is invoked/instantiated
<FromGitter>
<asterite> Macros seem like a very big hack in the language... I wonder how it could be done right
<RX14>
probably quote/unquote
<RX14>
but I like them
<RX14>
they're ugly
<FromGitter>
<asterite> :-P
<RX14>
quote/unquote makes the syntax clean on something which is still ugly
<RX14>
it just hides the ugliness
<RX14>
everyone accepts that macros are ugly if they're the way they are right now
<RX14>
and I like it
flaviodesousa has quit [Ping timeout: 248 seconds]
<FromGitter>
<asterite> Actually, including a module might be fine. When you include a module you get new methods. In this case you get JSON-serialization methods
<RX14>
yeah
<FromGitter>
<asterite> plus you can ask `if type.is_a?(JSON::Serlializable)`
<RX14>
i thought about it some more and it kinda makes sense
<FromGitter>
<asterite> (though it won't work for primitive types)
<RX14>
another thing is that you no longer have the to_json on Object
<RX14>
which trips people up sometimes
<FromGitter>
<asterite> Right, I'd like to define it on that module too
<RX14>
you just have it on JSON::Serializable
<FromGitter>
<asterite> Then, I also like the idea of just doing `@[JSON::Field(key: "foo")]` (or some other name)
<RX14>
well
<FromGitter>
<asterite> I think for now we could start without having to define `JSON::Field` nor what it can hold
<FromGitter>
<asterite> later we could try to make it more strict (though I think it's hard)
<RX14>
including JSON::Serializable shouldn't *do* anything by itself
<FromGitter>
<asterite> I don't know
<RX14>
you should also have to add @[JSON] on the ivars it should work on
<FromGitter>
<asterite> I think it's easier to assume that everything is serializable
<RX14>
I don't think so
<FromGitter>
<asterite> and exclude what you don't want to serialize
<RX14>
it's soo easy to accidentally add a fiend
<FromGitter>
<asterite> it works like that in C#, for example
<RX14>
lol I thought that's what you meant regarding "surprise" re: LLVM 6 @ysbaddaden
DTZUZU has quit [Ping timeout: 240 seconds]
<FromGitter>
<asterite> I was expecting something like "And now we can do this awesome thing with the C bindings"
<FromGitter>
<asterite> not "And now all our C bindings are broken"
<RX14>
well, it is awesome that we can get rid of the C++
<RX14>
and the C bindings break all the time
<RX14>
(we probably won't be able to get rid of all the C++)
<Yxhuvud>
what issue are you talking about regarding JSON?
<RX14>
Yxhuvud, just general design
<Yxhuvud>
some addition or replacement to JSON.mapping?
cbass has joined #crystal-lang
<Yxhuvud>
Those UUID issues/PR make me think of how ruby has to_str for stuff that is representable losslessly as a string which then get autoconverted on demand.
<RX14>
too much magick
<FromGitter>
<asterite> RX14: imagine having a type with several fields and wanting to add serialization. You have to annotate every field. Now imagine wanting to serialize it to another format too. Again, lots of annotations. With the other approach you just need to add another `include` and at most add an `Ignore` to fields you want to ignore
<FromGitter>
<asterite> Or for `record Point, x : Int32, y : Int32` you can't do it
<FromGitter>
<asterite> you have to use a block and annotate again the instance vars
cbass has quit [Ping timeout: 255 seconds]
<FromGitter>
<asterite> with the "serialize all" by default it's just an include
<RX14>
well you have to use block to include anyway
<FromGitter>
<asterite> By default, it seems to serialize all instance vars
<FromGitter>
<asterite> well, all struct fields
<FromGitter>
<asterite> and with the `json: ...` annotation you can control how it's done
<FromGitter>
<asterite> Of course there's no need to annotate that it is serializable because it's done with reflection at runtime
<FromGitter>
<asterite> Oh, actually: The json package only accesses the exported fields of struct types (those that begin with an uppercase letter). Therefore only the the exported fields of a struct will be present in the JSON output.
<RX14>
i really dislike that go is so subtle about what''s exported and not
<RX14>
well
<RX14>
I guess by-default is fine
<RX14>
everyone else does it that way
<FromGitter>
<asterite> I think it's a good convention
<FromGitter>
<bararchy> What do you guys think about applying Crystal to GSOC2018 ?
<Yxhuvud>
I think it depends a lot on context. I'd expect json inclusion by default from records, but not structs and objects (the same way the latter two don't generate accessors by default without explicit 'property'.
<Yxhuvud>
there is also a question of what to do for types that don't have a json conversion - exclude by default or exception when trying to generate/compile?
<RX14>
exception
<RX14>
changing the definitions on another type (i.e. making it serializable) shouldn't change the serialization of other types
<FromGitter>
<asterite> @bararchy what tasks could we propose for GSOC2018?
<RX14>
i think it's a cool idea
rohitpaulk has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
sz0 has joined #crystal-lang
<FromGitter>
<bararchy> @asterite well, we can break apart the multi-threading into manageable parts and that would be a nice one. Or, something regarding Compiler work? Etc..
<FromGitter>
<bararchy> We just need some people from the community to join as mentor
<FromGitter>
<asterite> Maybe, yes
baweaver has joined #crystal-lang
<FromGitter>
<bararchy> RX14 I think we need official Manas here, not sure who can nominate a project
<FromGitter>
<bararchy> Or at least core dev
<FromGitter>
<bararchy> Maybe @sdogruyol , he's good at those things :)
<RX14>
gsoc isn't really a way to get things done
<RX14>
it's for mentoring a student
<FromGitter>
<bararchy> True, but Ruby used it for stuff like JIT and other cool features
<FromGitter>
<bararchy> And off SciRuby
<FromGitter>
<bararchy> I would even mentor myself if someone wanna work on SHAInet or maybe Kemal ? Or other big community shard
<FromGitter>
<marksiemers> Anyone planning on submitting a proposal to the RailsConf in Pittsburg?
<FromGitter>
<bajro17> @sdogruyol Hi I will check if its possible to we somehow organize conf here maybe in march if its sound good for you until that time I will work to improve my skills on crystal
<FromGitter>
<bew> @asterite I don't like the "serialize all" on module inclusion, to me it doesn't give enough flexibility and does things too magically. IMO the `JSON::Serializable` module could give the user some macros to choose what to do, for example "I want to serialize all", or "I want to serialize this way" (not only based on the fields of the class/struct), or "I don't want to full package => only to_json"
<FromGitter>
<bew> Generally, the dev must be in control, including a module should not trigger something, but should make available some macros/methods that the dev can use to the trigger things proposed by the module in question
<FromGitter>
<bew> s/to the/to
wontruefree has joined #crystal-lang
<lvmbdv>
is this one liner ugly?
<lvmbdv>
(sexp.is_atomic?) ? sexp : ff(sexp.left)
<FromGitter>
<asterite> Maybes, yes. I don't know how to do it with just `include ...`. We probably need an attribute on top of the class. But I don't know, Go and C# serialize everything by default, so I don't know why we shouldn't do the same. The times I used JSON.mapping, I just defined instance vars for that model and that's it. Everything was serialized.
<FromGitter>
<bew> you don't need the `()` lvmbdv for the condition
<lvmbdv>
yeah but is_atomic? ? looks ugly
<lvmbdv>
the `? ?` does it for me
LastWhisper____ has joined #crystal-lang
<lvmbdv>
code A E S T H E T H I C S
<FromGitter>
<bew> to me the `is_<something>?` is ugly, there's already a `?`, no need for `is_`
<FromGitter>
<bew> if you can't stand the `? ?` don't oneline this :P
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jxv has joined #crystal-lang
<jxv>
How does Crystal deal with the lack of Nils? Does it have a Maybe/Option(al) type?
<ua>
jxv, it has nil
<RX14>
what do you mean "lack of nils"
<jxv>
let me reword it
<RX14>
we have a Nil class with a nil value
Renich_ has joined #crystal-lang
<RX14>
it's just another class
<jxv>
```NULL REFERENCE CHECKS
<jxv>
All types are non-nilable in Crystal, and nilable variables are represented as a union between the type and nil. As a consequence, the compiler will automatically check for null references in compile time, helping prevent the dreadful billion-dollar mistake.```
<RX14>
which you can union together
<jxv>
on the front page
<RX14>
yes...
<jxv>
So if I look up something that doesn't exist in an array or map, what do I get?
<RX14>
depends
<RX14>
either an exception or nil
<RX14>
ok, an example
<RX14>
if you have Array(Foo), and it's empty
<RX14>
array[0] will raise, and typeof(array[0]) is Foo
<RX14>
array[0]? will return nil, and typeof(array[0]?) is (Foo | Nil)
<RX14>
make sense jxv?
<jxv>
yeah, I think
<jxv>
is the (Foo | Nil) some kind of ad-hoc type?
<jxv>
on-demand
<RX14>
it's the union type between Foo and Nil
<jxv>
neat
<RX14>
which emans that a value of this type can either be Foo or Nil
<jxv>
Is it pattern matchable?
<RX14>
you typically use if to get rid of them
<RX14>
if foo; # here you have Foo; else ; # here you have nil; end
<RX14>
if you for some reason have Bool | Nil you have to use
<RX14>
if !foo.nil?; # here you have Foo; else ; # here you have nil; end
<jxv>
Can I deal what later?
LastWhisper____ has joined #crystal-lang
<jxv>
deal with that later***
<RX14>
what do you mean "later"?
<RX14>
they're just like any type
<jxv>
the pattern matching
<RX14>
any variable
<jxv>
okay, good
<RX14>
you pass them around
<RX14>
not all unions are with Nil
<jxv>
I assume I can do something like (Foo | Bar)
<RX14>
you can make unions like String | Int32
<RX14>
pass them around
<jxv>
That's perfect :D
<jxv>
could they be alias to some type name
<RX14>
do case foo; when String; # handle string; when Int32; ...
<jxv>
such that `Either(A,B) = (A | B)`
<RX14>
which is nice
relyks has joined #crystal-lang
<RX14>
jxv, but why bother?
<jxv>
long story: github.com/jxv/fluid
<RX14>
A | B is shorter than Either(A, B)
<RX14>
and the former syntax is much more flexible
<RX14>
it naturally extends from 1 to many types
<jxv>
I want some level consistency, but if it's really common. Then I'd budge
<RX14>
Option and Either are no longer special cases
<RX14>
they're just emergent from the union system as a whole
<jxv>
They're like anonymous sum type
<jxv>
s
<RX14>
well i guess that's what they are
<RX14>
i'm not well versed on the nomenclature of type theory
<RX14>
I presume you have a haskell background?
<jxv>
yes
<RX14>
or some similar FP?
<RX14>
jxv, we don't typically give names to unions
<RX14>
but you can with alias
<RX14>
unfortunately you can't have type parameters to an alias yet
<RX14>
so you couldn't do Either or Option
<jxv>
Alright
<RX14>
and even if you could, I don't think it would be best practice
<RX14>
hopefully we'll have generic aliases some day though
<jxv>
This is fine. Much better than most languages. Even haskell doesn't have anonymous sum types necessarily
<RX14>
yeah it's a unique feature
<RX14>
it's really at the heart of crystal's expressability I think