Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:27
    Blacksmoke16 closed #5636
  • 14:01
    asterite labeled #11541
  • 14:01
    asterite opened #11541
  • 10:11
    straight-shoota milestoned #11539
  • 04:46
    jgaskins opened #11540
  • Dec 04 22:54
    straight-shoota closed #11437
  • Dec 04 20:54
    BlobCodes synchronize #11211
  • Dec 04 20:51
    BlobCodes synchronize #11211
  • Dec 04 20:46
    BlobCodes synchronize #11211
  • Dec 04 17:55
    HertzDevil synchronize #11230
  • Dec 04 17:46
    BlobCodes synchronize #11211
  • Dec 04 17:44
    BlobCodes synchronize #11211
  • Dec 04 17:37
    BlobCodes synchronize #11211
  • Dec 04 16:10
    HertzDevil edited #11537
  • Dec 04 15:06
    HertzDevil synchronize #11230
  • Dec 04 15:03
    HertzDevil synchronize #11230
  • Dec 04 15:03
    BlobCodes synchronize #11211
  • Dec 04 14:13
    straight-shoota closed #11516
  • Dec 04 14:13
    straight-shoota closed #11492
  • Dec 04 14:13
    straight-shoota closed #11519
George Dietrich
@Blacksmoke16
https://athenaframework.org they're all pretty well documented
mfiano
@mjfiano:matrix.org
[m]
(I am not very great at writing docs, probably because I have too many forever projects to get to that point)
George Dietrich
@Blacksmoke16
is fairly easy with crystal since it handles the bulk of the work if you give argument/return type restrictions
then you just need to fill in contextual information and examples
to tie everything together
mfiano
@mjfiano:matrix.org
[m]
Did you have to jump through a lot of hoops to get the style of the generated API docs to be like the Crystal website instead of that plain purple theme that is the default? I would prefer doing as minimal webdev as possible :)
mfiano
@mjfiano:matrix.org
[m]
hmm
George Dietrich
@Blacksmoke16
isnt too bad, mostly just config but the default purple one would deff be easier as you have to do pretty much nothing
and just setup CI to deploy it to GH pages
mfiano
@mjfiano:matrix.org
[m]
I'm actually surprised Crystal isn't used much for gamedev after looking at the library space. Seems like it'd be a great language for that.
Probably moreso to do with the user count
Ary Borenszweig
@asterite
Depending on how many lines of code a game usually has, I think having to compile the app in release mode all the time to get something fast (good FPS) and waiting 5+ minutes for that is probably not good. So I'm not sure Crystal is good for real world game development
From IRC (bridge bot)
@FromIRC
<straight-> Game dev is not just about FPS though
Ary Borenszweig
@asterite
What do you mean?
mfiano
@mjfiano:matrix.org
[m]
I hear that, though often times you shouldn't need very fast performance when testing, unless you have a complex physics system or something.
So debug builds should be acceptable
Gamedev is about trying to compute as much as you can on the GPU, getting it there in time if not all up front, and then moving it back to the CPU when you need prettier graphics :P
Ary Borenszweig
@asterite
Makes sense. Yeah, maybe you get decent fps in debug builds
mfiano
@mjfiano:matrix.org
[m]
Rust's compiler is pretty slow and their gamedev community seems to be really ramping up since the last couple years, and the compiler was about 3x slower a few years ago when it first started picking up.
Though I hear they are trying to leverage dynamic runtime dispatch more to account for all the monomorphism eating compile times.
Does crystal use boehm?
Ary Borenszweig
@asterite
Interesting. But I know that Rust has modular compilation, so maybe it's slow the first time? No idea how well that's optimized
Yes, it uses boehm, but just because it works out of the box without us having to do much work. Crystal could use a different GC, eventually
mfiano
@mjfiano:matrix.org
[m]
I hear it's slow because the transitive dependency graph often contains many different versions of the same libraries, and all their functions are monomorphized. I'm not sure if it does DCE or not for this though.
1 reply
Think it's more a case of, the language has a large library ecosystem and encourages lots of re-use, plus fundamental monomorphic behavior, over a slow compiler. Can't really compare it to Crystal in either regard.
yet, anyway
Ary Borenszweig
@asterite
I know oprypin has written some games, also I think in Windows
mfiano
@mjfiano:matrix.org
[m]
Does Crystal have concurrent hash tables?
Benjamin Wade
@RespiteSage
Someone may have implemented them, but I don't know.
mfiano
@mjfiano:matrix.org
[m]
Would like to see a lockless one with CAS or something
That has been a huge complaint with my Lisp work anyway
Benjamin Wade
@RespiteSage
I feel like I constantly have this question, but is there a way to access the actual, compile-time type of a generic type within a class instantiation but not in a method?
Like
class Indigent(T)
  {% puts T %}
end

a = Indigent(Int32).new
Except it actually works.
George Dietrich
@Blacksmoke16
idt because T is only specific to an instance
Benjamin Wade
@RespiteSage
Hm... Okay.
I was wanting to set constants based on what type it is (specifically, MIN/MAX).
I bet I could do those as getters and set them in the initializer, though.
Ary Borenszweig
@asterite
Constants will be inside Indigent, not Indigent(Int32)
That is, you can't have constants have different values depending on T
1 reply
Plus you can't do Indigent(Int32)::MAX (I think that doesn't even parse)
Andrius Chamentauskas
@andriusch

Hello, I have this code:

class Animal
end

class Cat < Animal
  def meow
    puts "meow!"
  end
end

class Dog < Animal
  def woof
    puts "woof!"
  end
end

animals = Hash(Animal.class, Hash(Int32, Animal)).new { |h, k| h[k] = Hash(Int32, Animal).new }
animals[Cat][1] = Cat.new
animals[Dog][1] = Dog.new

animals[Dog][1].as(Dog).woof
animals[Cat][1].as(Cat).meow

dogs = animals[Dog].as(Hash(Int32, Dog))

and I'm getting an error on the last line:

 23 | dogs = animals[Dog].as(Hash(Int32, Dog))
             ^
Error: can't cast Hash(Int32, Animal) to Hash(Int32, Dog)

I don't understand why casting an element in the hash works, but casting the whole hash doesn't? Are there alternatives to what I'm trying to achieve (essentially index objects by type & by id)?

mfiano
@mjfiano:matrix.org
[m]
straight-shoota: Why does Shardbox have roughly 1/6 of the shards as some of the other databases? Yours is my favorite still though
George Dietrich
@Blacksmoke16
@mjfiano:matrix.org shardbox is manually curated, the others scrape github/gitlab and stuff
mfiano
@mjfiano:matrix.org
[m]
Ah I see.
George Dietrich
@Blacksmoke16
@andriusch because how would that work if the hash also contained a cat?
and because is typed as Animal that would be possible
Benjamin Wade
@RespiteSage
@andriusch It has to do with how generic types are implemented in Crystal. Other people are more able to explain why, but the basic idea is that even if T "inherits" from U, A(T) does not inherit from A(U).
In this particular case, you could use dogs = animals[Dog].transform_values &.as(Dog) on your last line.