00:01
<
FromGitter >
<watzon> `not_nil!` should be avoided
00:01
<
FromGitter >
<watzon> Much better to use a guard clause
00:04
<
FromGitter >
<watzon> There is also the `getter!` and `property!` macros which do use `not_nil!`under the hood, but make things a bit cleaner if you are in one of those situations where you need a nilable type but know for sure it won't be nil. So you can do: ⏎ ⏎ ```property! server : HTTP::Server? ⏎ # ... ⏎ server.bind_tcp``` [
https://gitter.im/crystal-lang/crystal?at=5ff8f2f999549911fc0e0641 ]
00:04
<
FromGitter >
<watzon> `not_nil!` can byte you in the ass though
00:55
<
sagax >
what right way if i need variable with nil type `?` ?
00:56
<
sagax >
simple check like as `somevar.nil?` not work
01:16
<
FromGitter >
<Daniel-Worrall> You need to assign it to a local value to nil check an instance variable
01:17
<
FromGitter >
<3n-k1> > @3n-k1 so you figured it out? ⏎ sure did, forgot that `macro; end` is a thing lol
01:18
<
FromGitter >
<Daniel-Worrall> Sagas
01:19
<
FromGitter >
<Daniel-Worrall> Sagax
01:20
<
FromGitter >
<3n-k1> anyway, i'm trying to get a list of all built-in classes in crystal. currently just doing `{{Object.all_subclasses}}` but that's kinda hacky and super fragile because it has to run before any other class definitions. is there a better way to go about this?
01:23
<
sagax >
`.try` work
01:42
<
FromGitter >
<Blacksmoke16> @3n-k1 that ofc is also going to include custom classes
01:42
<
FromGitter >
<Blacksmoke16> whats your use case/
02:04
deavmi has quit [Ping timeout: 272 seconds]
02:08
<
sagax >
how to write `limitations` shorty?
02:08
<
FromGitter >
<Blacksmoke16> Hm?
02:08
<
sagax >
`if foo = @foo` or `@foo.try do |foo|`
02:10
<
FromGitter >
<Blacksmoke16> Depends on the context imo
02:10
deavmi has joined #crystal-lang
02:13
<
FromGitter >
<Blacksmoke16> `foo.try &.foo_method`
02:21
<
FromGitter >
<3n-k1> @Blacksmoke16 trying to create a gui version of `tool hierarchy` that doesn't include builtin classes
02:21
<
FromGitter >
<Blacksmoke16> Gl
02:27
<
FromGitter >
<3n-k1> current plan is to get builtin classes at compile time, then use `tool hierarchy` and filter out builtins
02:27
<
FromGitter >
<3n-k1> could also just run `tool hierarchy` twice, once on an empty file, and then diff the trees
02:28
<
FromGitter >
<3n-k1> that sounds hackier but also much easier
02:31
<
FromGitter >
<3n-k1> i
*guess* i could also use a macro to run the empty `tool hierarchy` at compile time
02:41
<
FromGitter >
<watzon> @sagax I highly recommend using
https://carc.in for Crystal example code
02:42
<
FromGitter >
<watzon> Makes it easier to test and share better ways of doing things
02:53
<
FromGitter >
<3n-k1> carc.in is only temporary though, right?
02:53
<
FromGitter >
<watzon> Not as far as I know
03:06
alexherbo2 has quit [Ping timeout: 246 seconds]
03:11
f1refly has joined #crystal-lang
03:13
f1reflyylmao has quit [Ping timeout: 264 seconds]
03:27
<
FromGitter >
<mattrberry> My favorite part about emudev communities is the totally broken emulator screenshots/videos, so I figured I'd share some of that here :)
03:37
<
FromGitter >
<3n-k1> i'm amazed at how close that is, and also how ridiculously broken it is
03:44
avane has quit [Ping timeout: 240 seconds]
03:56
avane has joined #crystal-lang
04:00
avane has quit [Client Quit]
04:02
avane has joined #crystal-lang
04:07
<
FromGitter >
<watzon> That's a thing of beauty @mattrberry
04:32
Volk has quit [Quit: See you next time!]
04:42
richbridger has quit [Read error: Connection reset by peer]
04:54
<
FromGitter >
<mattrberry> I haven’t don’t any affine transformations yet, which causes the broken sprites and Pokémon logo haha. Also need proper hdma to get the clouds to be wavy on the title screen
04:55
<
FromGitter >
<mattrberry> And the broken placement of rayquaza‘a beam, plus the groudon and kyogre scenes
06:40
_whitelogger has joined #crystal-lang
08:31
aerona has joined #crystal-lang
08:31
aerona has quit [Client Quit]
09:29
deavmi has quit [Ping timeout: 272 seconds]
09:31
_ht has joined #crystal-lang
09:34
postmodern has quit [Remote host closed the connection]
09:36
deavmi has joined #crystal-lang
09:44
<
hightower2 >
ah I see, the all=0 should be all with no default value
09:45
<
hightower2 >
hm, still an issue
09:46
<
hightower2 >
it works if I change the order of initializes. Is that expected?
09:54
<
oprypin >
hightower2: like, u realize that a call with 1 arg matches both methods?
09:54
<
oprypin >
then yes the order comes into play, that's normal i think
09:54
<
hightower2 >
ok, thanks
10:28
alexherbo2 has joined #crystal-lang
10:54
<
hightower2 >
oprypin, even though, my example called it with 4 args
10:55
<
hightower2 >
didn't realize up to now that that's how resolution worked
11:49
deavmi has quit [Ping timeout: 272 seconds]
11:55
deavmi has joined #crystal-lang
12:10
<
oprypin >
hightower2: hmm i also didn't properly check what you were trying to show. that
*is* weird
12:12
deavmi has quit [Read error: Connection reset by peer]
12:14
deavmi has joined #crystal-lang
12:18
<
oprypin >
probably specific to initialize, too
12:23
<
hightower2 >
pretty interesting
12:23
deavmi has quit [Read error: Connection reset by peer]
12:24
deavmi has joined #crystal-lang
12:59
deavmi has quit [Ping timeout: 260 seconds]
13:09
deavmi has joined #crystal-lang
13:43
deavmi has quit [Read error: Connection reset by peer]
13:54
deavmi has joined #crystal-lang
13:59
deavmi has quit [Ping timeout: 272 seconds]
14:09
ua has quit [Ping timeout: 240 seconds]
14:19
deavmi has joined #crystal-lang
14:23
ua has joined #crystal-lang
14:25
deavmi has quit [Ping timeout: 272 seconds]
14:33
Volk has joined #crystal-lang
14:40
ua has quit [Ping timeout: 264 seconds]
14:45
deavmi has joined #crystal-lang
14:50
deavmi has quit [Ping timeout: 272 seconds]
14:53
ua has joined #crystal-lang
15:01
deavmi has joined #crystal-lang
15:09
deavmi has quit [Ping timeout: 272 seconds]
15:29
deavmi has joined #crystal-lang
15:41
deavmi has quit [Ping timeout: 240 seconds]
15:51
ua has quit [Ping timeout: 256 seconds]
16:05
ua has joined #crystal-lang
16:09
Stephie has quit [Read error: Connection reset by peer]
16:12
Stephie has joined #crystal-lang
16:19
DTZUZU has quit [Ping timeout: 246 seconds]
16:21
DTZUZU has joined #crystal-lang
16:22
deavmi has joined #crystal-lang
16:47
ua has quit [Ping timeout: 246 seconds]
16:56
<
FromGitter >
<HertzDevil> `Crystal::Type#parents` only includes the direct superclass and directly included modules, right
16:59
<
FromGitter >
<HertzDevil> because it seems indirect ones are covered by `#ancestors` (the same one provided by `TypeNode`)
17:01
ua has joined #crystal-lang
17:02
deavmi has quit [Ping timeout: 246 seconds]
17:05
<
oprypin >
i dont know but sounds sensible
17:07
ua has quit [Ping timeout: 256 seconds]
17:13
deavmi has joined #crystal-lang
17:20
V[excess] is now known as ^
17:21
ua has joined #crystal-lang
17:43
deavmi has quit [Ping timeout: 272 seconds]
17:52
deavmi has joined #crystal-lang
17:54
deavmi has quit [Read error: Connection reset by peer]
17:56
deavmi has joined #crystal-lang
18:05
deavmi has quit [Ping timeout: 272 seconds]
18:18
deavmi has joined #crystal-lang
18:40
<
sagax >
what different between `struct` and `class` ?
18:41
<
FromGitter >
<Blacksmoke16> structs are allocated on the stack while classes are allocated on the heap
18:41
<
FromGitter >
<Blacksmoke16> related, structs are passed by value, while classes are passed by reference
18:42
<
FromGitter >
<Blacksmoke16> normally you want to use structs for small immutable objects
18:42
<
FromGitter >
<Blacksmoke16> that tend to be created/deleted often as the GC wont need to track them
18:42
richbridger has joined #crystal-lang
18:42
<
FromGitter >
<erdnaxeli:cervoi.se> Struct does not need work from the gc
18:42
<
FromGitter >
<erdnaxeli:cervoi.se> (plus everything @Blacksmoke16 says)
18:50
deavmi has quit [Ping timeout: 246 seconds]
18:51
<
sagax >
abstract class it's like interface?
18:52
<
FromGitter >
<Blacksmoke16> a module would be more similar to that
18:52
<
FromGitter >
<Blacksmoke16> as it could be added to both classes and structs (and other modules)
18:53
<
FromGitter >
<jrei:matrix.org> abstract class/struct forces you to use class/struct, which can be a good/bad thing. Depends of what you want to do
18:54
<
FromGitter >
<Blacksmoke16> also keep in mind you can inherit from both classes and abstract classes but you can only inherit from abstract structss
18:57
<
FromGitter >
<jrei:matrix.org> Right. What is the explanation behind?
18:58
<
FromGitter >
<Blacksmoke16> something about the memory layout of it needs to be known
18:59
<
sagax >
crystal have something like as `irb` or `pry`? i understand that crystal it's compiled language, but maybe we have something tools
18:59
<
FromGitter >
<Blacksmoke16> `crystal play` is also an option, or just have a `test.cr` file and keep running it
19:05
<
oprypin >
watzon, do you mind if i link to your website as part of "showcase" for the doc generator
19:07
deavmi has joined #crystal-lang
19:08
deavmi has quit [Read error: Connection reset by peer]
19:09
deavmi has joined #crystal-lang
19:10
<
FromGitter >
<watzon> Of course not
19:10
<
FromGitter >
<watzon> By all means
19:18
deavmi has quit [Ping timeout: 256 seconds]
19:25
deavmi has joined #crystal-lang
19:29
deavmi has quit [Remote host closed the connection]
19:30
deavmi has joined #crystal-lang
20:02
ua has quit [Ping timeout: 256 seconds]
20:06
<
FromGitter >
<jrei:matrix.org> Good work oprypin! I still find it harder to browse than the classic API docs
20:07
<
FromGitter >
<jrei:matrix.org> In the middle of a doc page, it is not clear if the method definition is the one above or below
20:08
<
FromGitter >
<jrei:matrix.org> Ha i see you added a view-source link
20:08
<
FromGitter >
<watzon> I feel like the background color I gave method definitions in my docs helps a bit with that
20:09
<
FromGitter >
<watzon> Though maybe I should indent the descriptions a bit as well
20:09
Volk has quit [Quit: See you next time!]
20:11
<
oprypin >
jrei:matrix.org, styles are pretty much all default. in fact,
*I* can't add new defaults. but anyone can style this in any way they want
20:11
<
FromGitter >
<jrei:matrix.org> I agree @watzon , that's even better!
20:11
<
FromGitter >
<jrei:matrix.org> Compared to Athena, yours is a lot more readable thanks to code blocks and view-source. However, no dark theme
20:12
<
FromGitter >
<watzon> What I need is a way to toggle the dark and light theme
20:12
<
FromGitter >
<watzon> Do you know if there is a built in way to do that with the material theme @oprypin?
20:12
<
oprypin >
gotta pay 10 euros for that lol
20:12
<
FromGitter >
<watzon> Ahh is it a part of the insiders stuff?
20:14
<
sagax >
i read docs, but don't understand when i must user `property` and when i must use `getter` ?
20:14
<
oprypin >
sagax, property = getter + sette
20:14
<
sagax >
hm, i just don't see examples with `setter`
20:15
<
oprypin >
it's super rare to have a setter without getter, so yea
20:15
<
FromGitter >
<watzon> Yeah `getter` defines a `def {{ name }}` method while property defines that, and `def {{ name }}=(value)`
20:16
<
FromGitter >
<watzon> Setters definitely aren't super common. Usually you either want a property to just be accessible, or for it to be accessible and settable.
20:16
ua has joined #crystal-lang
21:10
<
FromGitter >
<kingsleyh> hello - my builds keep failing intermittently on Travis CI with `Invalid memory access (signal 11) at address 0x7fab39fd0818` - does anyone else have this issue? and any suggestions what to do about it? I get the feeling it's running out of memory when compiling or something like that
21:13
<
FromGitter >
<kingsleyh> also does anyone use github actions instead of Travis? does it work ok with Crystal?
21:14
<
FromGitter >
<oprypin:matrix.org> @kingsleyh yes everyone uses GitHub actions
21:14
<
FromGitter >
<kingsleyh> ok cool - maybe I will a better experience with that over Travis then
21:16
deavmi has quit [Ping timeout: 256 seconds]
21:17
<
FromGitter >
<kingsleyh> awesome thanks :)
21:21
deavmi has joined #crystal-lang
21:21
_ht has quit [Remote host closed the connection]
21:25
deavmi has quit [Ping timeout: 272 seconds]
21:31
Volk has joined #crystal-lang
21:33
deavmi has joined #crystal-lang
21:38
deavmi has quit [Ping timeout: 272 seconds]
21:44
alexherbo24 has joined #crystal-lang
21:45
alexherbo2 has quit [Read error: Connection reset by peer]
21:45
alexherbo24 is now known as alexherbo2
21:47
deavmi has joined #crystal-lang
21:48
Nekka has quit [Quit: zzz]
21:51
deavmi has quit [Ping timeout: 272 seconds]
21:57
Nekka has joined #crystal-lang
21:57
deavmi has joined #crystal-lang
22:08
<
FromGitter >
<3n-k1> yesterday i learned about affine transformations
22:08
<
FromGitter >
<3n-k1> whoops, i was scrolled
*way* far back
22:13
Nekka has quit [Quit: zzz]
22:15
Nekka has joined #crystal-lang
22:31
Nekka has quit [Quit: zzz]
23:03
f1refly has quit [Ping timeout: 265 seconds]
23:56
f1refly has joined #crystal-lang