Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 23 14:58
    RubenBrocke opened #8713
  • Jan 23 09:28
    jhass labeled #8712
  • Jan 23 09:28
    jhass labeled #8712
  • Jan 23 09:28
    jhass labeled #8712
  • Jan 23 09:09
    repomaa opened #8712
  • Jan 22 14:07
    straight-shoota synchronize #8708
  • Jan 21 23:43
    straight-shoota labeled #8711
  • Jan 21 23:43
    straight-shoota labeled #8711
  • Jan 21 23:43
    straight-shoota opened #8711
  • Jan 21 21:26
    straight-shoota labeled #8710
  • Jan 21 21:26
    straight-shoota labeled #8710
  • Jan 21 21:25
    straight-shoota review_requested #8710
  • Jan 21 20:59
    Sija opened #8710
  • Jan 21 20:47
    jwoertink opened #8709
  • Jan 21 18:53
    bcardiff milestoned #8702
  • Jan 21 18:53
    bcardiff closed #8702
  • Jan 21 18:53
    bcardiff closed #7422
  • Jan 21 18:41
    straight-shoota labeled #8708
  • Jan 21 18:41
    straight-shoota labeled #8708
  • Jan 21 18:41
    straight-shoota opened #8708
From IRC (bridge bot)
@FromIRC
<ua_> syntax but not stdlib should be more emphasized lol
<repo> well.. it is fairly similar still
<repo> chances are stuff just works
<repo> you don't have that with a lot of languages
<repo> but i do understand your frustration
<repo> devdocs is your friend :⁠)
Lairan
@alex-lairan

Hi, guys ! :)

I have troubles with this Warning :

 28 | abstract def map_or(default : U, lambda : T -> U) : U forall U
                                                          ^
Warning: can't resolve return type U

The above warning will become an error in a future Crystal version.

I don't know what's the problem with the line ?

Blacksmoke16
@Blacksmoke16
The type that implements that method must declare the return type
Also, the docs are pretty clear IMO
Have a syntax similar to Ruby (but compatibility with it is not a goal)
Just because the syntax is similar doesn't mean it's a clone
Lairan
@alex-lairan
I don't understand, forall worked in previous versions
Blacksmoke16
@Blacksmoke16
Oh sorry, diff warning
Could try just removing the type restrictions, since if you're not actually using U in the method it's essentially the same as not having one
Lairan
@alex-lairan
Ok, thanks @Blacksmoke16 alex-lairan/monads@5b77aa0
So specifying return type on Crystal 0.32+ is not recommanded ?
Blacksmoke16
@Blacksmoke16
No, might be a bug related to forall as the return type
From IRC (bridge bot)
@FromIRC
<sorcus> Crystal doesn't have rotate method for Slice?
Lewis E. Bogan
@lebogan

Trying to install amber on Ubuntu.

curl -L https://github.com/amberframework/amber/archive/stable.tar.gz | tar xz
cd amber-stable/
make
sudo make install

got an error about resolving db (~> 0.7.0 ~>0.8.0). Did I miss something?

Johannes Müller
@straight-shoota
@lebogan Probably an issue with version restrictions. Amber and its dependencies want different releases of db. You might manually edit the version in shard.yml to fix this.
Lewis E. Bogan
@lebogan
Okay, I'll give it a shot. Thanks
Lewis E. Bogan
@lebogan
@straight-shoota , after commenting and uncommenting db stuff, it seems like micrate is the culprit. I tried 0.3.0, 0.4.0, 0.5.0. Without it the make works. Hmmm
Lewis E. Bogan
@lebogan
@straight-shoota I changed the db version in my local lib/micrate and make worked. shards update still doesn't. Should I be concerned?
Giorgi Kavrelishvili
@grkek
@Blacksmoke16 would you mind checking out the PR
Blacksmoke16
@Blacksmoke16
Can when I get home tomorrow night, am out of town for a bit
Jeremy Woertink
@jwoertink
Question if there's a way to do this. You know when you have a method that returns Thing?, then you do if thing, and inside that if branch, the compiler knows that it exists? I have a method I'm passing the thing in to if check(thing), and in my if branch I have to do thing = thing.as(Thing) or callnot_nil!.
Is there another way to do this?
Kai Leahy
@tenebrousedge
try
Jeremy Woertink
@jwoertink
Right, but I'd have to do it several times.
I mean a way to tell the crystal that inside that branch, the object isn't nil without doing the variable reassignment
Kai Leahy
@tenebrousedge
try or not_nil! or nested ifs are kinda what you have to work with
at least at runtime
what are you trying to do?
Jeremy Woertink
@jwoertink
thing = find_thing

if thing
  thing.this
  thing.that
  thing.whatever
end
That's what I have currently which is cool and all, but I had to change it
thing = find_thing

if check(thing)
 thing = thing.as(Thing)
  thing.this
  thing.that
  thing.whatever
end
but now I have this
I guess I could do if thing && check(thing) 🤔
yeah, I'll do that. Thanks!
Kai Leahy
@tenebrousedge
:plus1:
Kai Leahy
@tenebrousedge
Kai wrote a codewars kata https://www.codewars.com/kata/5e29d57ac6b9af00333abd19
It's sorta derivative, but still good
From IRC (bridge bot)
@FromIRC
<raz> why did the homepage motto change btw? 'fast as C, slick as ruby" was great.
<raz> "a language for humans and computers" sounds like placeholder text
<raz> like duh, who else would it be for ¯_(ツ)_/¯
Kai Leahy
@tenebrousedge
I would imagine that the speed claims were arguable, and the similarity to Ruby equally so
From IRC (bridge bot)
@FromIRC
<raz> yes! that's part of what made it great
<raz> plenty publicity from kids getting their panties in a knot over it on reddit and hn
Kai Leahy
@tenebrousedge
personally, I don't approve of trolling, for any purpose
From IRC (bridge bot)
@FromIRC
<raz> nothing trolly about, it's the best one-line summary i've heard (and still give!) up to this day
<raz> i certainly don't say... "uh yea..um.. so, it's a language for humans and also for computers"