pawnbox_ has quit [Remote host closed the connection]
<ruslux>
Thank you
sandelius has joined #crystal-lang
<jhass>
asterite: btw made me notice, so struct Foo; end; Foo.new is Foo < Struct < Value < Object while class Bar; end; Bar.new is Bar < Reference < Object, isn't the additional Struct in the former case a bit inconsistent?
<ruslux>
So, i should implement own `==` for header, for compare by `request_id`, for example?
<ruslux>
tnx, tnx, tnx.
ruslux has quit [Quit: Page closed]
pawnbox has joined #crystal-lang
ruslux has joined #crystal-lang
ruslux has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sp4rrow has quit [Quit: Textual]
ruslux has joined #crystal-lang
ruslux has quit [Client Quit]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
<crystal-gh>
[crystal] asterite closed pull request #2784: Make the `system` macro call set the current working directory (master...feature/system_chdir) https://git.io/voOKs
<asterite>
crime: Essentially what HKT gives us is the ability to generalize across type constructors – where a type constructor is anything that has a type parameter . Sounds like generics. What's the difference?
<jhass>
asterite: mmh, did you ever try to draw a UML of Crystals core class design?
<jhass>
:P
<asterite>
should be easy to do by using graphviz
paulcsmith_ has quit [Ping timeout: 276 seconds]
<asterite>
in fact it would be a nice little project to do (for any shard, or the std)
<asterite>
jhass: the Struct type is there so you can define methods only for structs, but not for all values. That's at least the reason
<jhass>
asterite: nah I mean really core stuff, Class, Object, Struct...
<jhass>
yeah I see the reason but it seems inconsistent
<jhass>
give me a second
<asterite>
jhass: oh, that! With the metamodel?
<jhass>
yes
<asterite>
we tried to do it a couple of times with waj but failed... we tried to check what smalltalk and objective-c do, but we are missing something...
<asterite>
well, probably more than a couple of times
<asterite>
I think we are missing something like Object.class being Object:Class and not just Class... I think in objective-c it's Class
<asterite>
I think introducing Module should be easy
<asterite>
but I don't understand why the red arrow in the struct
<asterite>
In fact, let me try to make a Module now, see how hard is it
<BlaXpirit>
crazy stuff
<crime>
asterite: HKT allows for abstracting over types themselves. in crystal, that would mean I could differentiate between ints, floats, int|float, T, etc
<jhass>
asterite: let me ask it as a question, what method of Struct, that should be present in instances of structs (instances of child classes of Struct), can't be or conceptually shouldn't be in Value?
<asterite>
well, hash is defined by iterating all instance vars
<asterite>
values that are not structs don't have instance vars
<asterite>
same goes for to_s, ==, etc.
<jhass>
what kind of Value do we even have that aren't Struct?
<jhass>
Primitives?
<jhass>
btw do you see the conceptual inconsistency between Struct and Class or do I still have to convince you of it? :P
<asterite>
primitives, enum
<asterite>
Umm... A Class is actually a struct
<asterite>
well, a value
<asterite>
but... mmm... I don't see the inconsistency
<jhass>
well, in my mind Struct and Class are the same, just for Reference things vs for Value things
<jhass>
do we agree so far?
<jhass>
mh, if Class is an instance of Struct, is Struct an instance of Struct too?
rolha has quit [Ping timeout: 246 seconds]
<asterite>
Class represents types, it's not to distinguish between reference and values
<asterite>
maybe it should be called Type
<asterite>
so then we have Type, Reference, Value, Struct, Object
<asterite>
Struct is an instance of Type
<asterite>
but... don't mind me, I always get confused with this
<asterite>
I tried to do the Module thing, I got confused
<jhass>
:/
<asterite>
:-(
<jhass>
I think it would be good if we do model this out in UML like we want it
<asterite>
Definitely, though I don't think it has much priority... it's a nice to have, and will definitely happen before 1.0, but I don't see a real use case for introducing Module
<jhass>
classes are types, structs are types
<asterite>
(other than consistency)
<jhass>
enums are types
<jhass>
primitives are types
<jhass>
anything else that defines a type?
<jhass>
mmmh, C unions I guess
<jhass>
also how different are enums and C enums, if at all?
<jhass>
does lib define a type?
<jhass>
it's more a special module
<asterite>
they are not different... they used to be
<asterite>
in fact, they didn't use to be, they only existed for C
<asterite>
then we decided to have them outside too
<asterite>
in fact, I've been thinking a lot about unifying c structs and union with crystal structs... I'd really like that to happen, and I'll probably try to do that soon
<asterite>
mmm... maybe it should be Class, but then if someone defines a `read` method on Class it will break `fun read`, I guess
<Davy_CC>
what's the different between Value and Reference?
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<jhass>
Davy_CC: pass by reference and pass by value, or in other words allocated on the heap vs allocated on the stack
<jhass>
asterite: maybe it should be Type < Object, Value and Reference should become (marker) modules, then Class < Type, Class include Reference, Struct < Type, Struct include Value, Module < Type, Enum < Type, Lib < Type etc
<Davy_CC>
I mean Reference can be a Value which has the pointer points to the instance, can't it?
<jhass>
class Foo -> Foo = Class.new, struct Foo -> Foo = Struct.new, module Foo -> Foo = Module.new, enum Foo -> Enum.new and so on (and still only conceptually)
<asterite>
I see. So one type for each concept in the language
<jhass>
yes
<asterite>
lib Foo -> Foo = Lib.new ?
<jhass>
yes
<jhass>
not sure what primitives would be though with that
<asterite>
a primitive is just a Value
<jhass>
yes but then struct Int32 -> Int32 = Struct.new doesn't hold
<Davy_CC>
what will happen when I define a class inherits from Type or Object, like class Foo < Type ?
<asterite>
maybe it should be `value Int32` :-P
<jhass>
Davy_CC: a compile time error
<asterite>
Or maybe we could remove `Struct`, and have `Value` iterate over instance vars... just that primitives don't have instance vars, and in any case override those methods
<jhass>
mmh, yeah
<jhass>
might be simpler
<asterite>
then of course we have class Object, but struct Value... so a struct inheriting from a class
<asterite>
This is the same in C#
snsei_ has joined #crystal-lang
<Davy_CC>
are there any other classes inherits from Object?
<jhass>
not currently
<jhass>
mmh, I also like the Class < Module property in Ruby
<ragmaanir>
question: whats the best way to achieve this: i have an array X of A. A is abstract but has several subclasses. i want to create a new array that only contains the elements of X that are of one specific subclass. The type of the new array should be Array(S) with S being the subclass.
<asterite>
x.map &.as(S)
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/voG3R
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/voGBp
<crystal-gh>
crystal/master 5432eda Ary Borenszweig: Fixed #1030: show full argument type name when the restriction alone matches the argument type name
Oliphaunte has quit [Remote host closed the connection]
snsei_ has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
paulcsmi_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Davy_CC>
asterite: how about struct Object? and Class is inheriting from Struct but includes (module) Referenced. Then every types without Referenced are Values. >> < asterite> then of course we have class Object, but struct Value... so a struct inheriting from a class
<Davy_CC>
I know that won't be changed soon, but I think this is interesting
<crystal-gh>
[crystal] asterite opened pull request #2793: GIve syntax error when using a local variable inside an assignment to… (master...feature/local_var_assign_shadow) https://git.io/voG67
<asterite>
and in the compiler a type is called Type, not Class :-P
<Davy_CC>
cool
paulcsmith_ has joined #crystal-lang
rolha has quit [Ping timeout: 272 seconds]
Oliphaunte has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/voGDY
steenuil has quit [Read error: Connection reset by peer]
steenuil has joined #crystal-lang
ryanw-se has joined #crystal-lang
<crystal-gh>
[crystal] asterite opened pull request #2795: Make `{"foo": 1}` also be a named tuple (master...feature/named_argument_string) https://git.io/voZvW
bcardiff has quit [Quit: bcardiff]
bcardiff has joined #crystal-lang
bcardiff has quit [Ping timeout: 260 seconds]
<havenwood>
Is there still an example RubyGems extension written in Crystal around? I recall it being in the Crystal repo but can't seem to find it.
paulcsmi_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Oliphaunte has quit [Remote host closed the connection]
kulelu88 has joined #crystal-lang
gloscombe has joined #crystal-lang
ruslux has quit [Ping timeout: 250 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
ragmaanir has quit [Quit: Leaving]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
gloscombe has quit [Quit: Lost terminal]
senorprogrammer has joined #crystal-lang
<crystal-gh>
[crystal] asterite closed pull request #2795: Make `{"foo": 1}` also be a named tuple (master...feature/named_argument_string) https://git.io/voZvW
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
donpdonp has joined #crystal-lang
<donpdonp>
'undefined method 'length' for Array(JSON::Type) (compile-time type is JSON::Type)
<donpdonp>
hmm got my langs mixed up. .size
soveran has quit [Remote host closed the connection]
<donpdonp>
.as_a.map{|a| puts a.class} => gives all "Array(Json::Type)", but puts.size gives "undefined method 'size' for Bool (compile-time type is JSON::Type)"
<donpdonp>
its an array of arrays parsed from json. I dont understand why puts a.size is giving an err about Bool
<asterite>
jhass: if you want/can, whenever you have time, please add all the openssl stuff to the changelog... I prefer you to do that because you understand what you did :-)
<jhass>
I'll try to keep it in mind
<asterite>
jhass: no rush at all, I plan to release 0.18.0 next week, and I'll wait for ysbaddaden to upgrade shards to the new behaviour