Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 05 15:55
    Blacksmoke16 closed #13047
  • Feb 05 15:53
    serge-hulne closed #13047
  • Feb 05 15:45
    Blacksmoke16 edited #13047
  • Feb 05 15:42
    serge-hulne labeled #13047
  • Feb 05 15:42
    serge-hulne opened #13047
  • Feb 05 02:16
    renovate[bot] edited #12735
  • Feb 04 23:27
    straight-shoota milestoned #12966
  • Feb 04 23:27
    straight-shoota milestoned #12966
  • Feb 04 22:45
    Blacksmoke16 synchronize #12966
  • Feb 04 12:51
    straight-shoota closed #12224
  • Feb 04 12:51
    straight-shoota closed #13034
  • Feb 04 12:15
    straight-shoota milestoned #12921
  • Feb 04 12:15
    straight-shoota milestoned #12921
  • Feb 04 10:44
    straight-shoota edited #12921
  • Feb 04 02:39
    cyangle synchronize #12921
  • Feb 04 01:08
    cyangle synchronize #12921
  • Feb 04 01:08
    cyangle synchronize #12921
  • Feb 03 22:11
    straight-shoota labeled #12794
  • Feb 03 22:11
    straight-shoota assigned #12794
  • Feb 03 22:07
    straight-shoota synchronize #12959
From IRC (bridge bot)
@FromIRC
<Papierkorb_> Hi sdogruyol!
Bar Hofesh
@bararchy
I hate C bindings
hahaha
Ghost
@ghost~55586c4815522ed4b3e08557
@bararchy why? ˆˆ
@oprypin good catch, thanks
Bar Hofesh
@bararchy
@bew working on getting crystal-fann to support Float64 instead of Float32, the underlying C lib gives me trubles and I don't really know why :\
NeuraLegion/crystal-fann#6
so annoying :(
Ghost
@ghost~55586c4815522ed4b3e08557
Ah, no idea how I could help, I don't understand anything about what you'r doing! :joy:
Bar Hofesh
@bararchy
lol, it's just something stupid , I guess I need something to be a float ...
Is there a way to automagiclly cast Array(Float64) to Array(Float32) ?
Ghost
@ghost~55586c4815522ed4b3e08557
With a map?
You can't automagically do that
Plus, I think you need to save the generated array before sending it to the lib (to prevent it being collected by the gc while in us in the lib)
Bar Hofesh
@bararchy
Something I would really like in specs, it to have a
on_fail do 
  puts debug_info
end
this way I don't need to just print stuff out if I dont need it
only if specs fails
Rubi
@codenoid

btw,

puts "slay"
exit 0
at_exit { puts "bye" }

why at_exit should be above exit

Serdar Dogruyol - Sedo セド
@sdogruyol
you call exit before declaring at_exit
From IRC (bridge bot)
@FromIRC
<oprypin> @codenoid, at_exit is a method. in your example it's never called
Rubi
@codenoid
but, "I will do at_exit, when I exit " :/ :+1:
Serdar Dogruyol - Sedo セド
@sdogruyol
why not moving at_exit line up?
Rubi
@codenoid
I am just asking :shipit:
Bar Hofesh
@bararchy
@codenoid you can also
def foo
  bla
  bla
  exit
rescue SystemExit
  do stuff here
end
I wouldn't do that, but it's a posibilty
Ghost
@ghost~55586c4815522ed4b3e08557
Huh
Not in Crystal
Bar Hofesh
@bararchy
wouldn't work ?
From IRC (bridge bot)
@FromIRC
<oprypin> undefined constant SystemExit
Ghost
@ghost~55586c4815522ed4b3e08557
Exit doesn't raise an exception
Bar Hofesh
@bararchy
Oh..
Ghost
@ghost~55586c4815522ed4b3e08557
It simply exits!
Bar Hofesh
@bararchy

In Ruby this:

def test
  exit
rescue Exception => e
  puts e, e.class
end

test

Returns this:

exit
SystemExit
So I guess in this regard it's not comptabile
@codenoid Sorry for misleading
Rubi
@codenoid
no problem @bararchy , thanks for sharing :sparkles:
Paul Smith
@paulcsmith
Is there a way to rescue compile time errors in order to provider more info to the user? I've found that in some of the libraries I'm writing the compile time errors would be a lot more helpful with a little more info. So instead of something like "must return LuckyWeb::Response not WhateverType" it could say that and "that usually means you need to call render or redirect at the end of your action"
From IRC (bridge bot)
@FromIRC
<oprypin> @paulcsmith, no u cant rescue, but maybe u can anticipate those cases and make them nonfatal but with a manual {% raise "" %} in them
<oprypin> needs an example to say more
<oprypin> if return_result.is_a? LuckyWeb::Response; good stuff; else; {% raise
Paul Smith
@paulcsmith
@oprypin thanks for the suggestion. Here's a more thorough example: https://gist.github.com/paulcsmith/3282626b39c0ba626db3e135bc1a66a2
Does that make more sense now? render and redirect both return a LuckyWeb::Response
From IRC (bridge bot)
@FromIRC
<oprypin> @paulcsmith, nah has to be a runnable exammple
Paul Smith
@paulcsmith
Ok one sec. I"ll try to put something together
From IRC (bridge bot)
@FromIRC
<oprypin> i suspect that action has like &block : -> LuckyWeb::Response
<oprypin> in which case add another one with &block : -> _ that has {% raise "foo" %} as its body
<oprypin> also # :nodoc: it. not sure if it's worth it tho
Paul Smith
@paulcsmith
@oprypin https://play.crystal-lang.org/#/r/2t8s is a runnable example
In this case it's fairly clear you need render but in the framework it's less clear what a LuckyWeb::Response is since you never directly instantiate it. You always use render/redirect/etc.
From IRC (bridge bot)
@FromIRC
<oprypin> yeah that's not possible to intercept
<oprypin> but you do have the : Response part clearly there