Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:03
    kramerul synchronize #12404
  • Aug 19 18:56
    asterite ready_for_review #12405
  • Aug 19 18:56
    asterite edited #12405
  • Aug 19 17:43
    asterite labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:02
    asterite synchronize #12405
  • Aug 19 16:01
    asterite opened #12405
  • Aug 19 15:34
    kramerul synchronize #12404
  • Aug 19 15:23
    kramerul synchronize #12404
  • Aug 19 15:13
    kramerul synchronize #12404
  • Aug 19 15:10
    kramerul synchronize #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:06
    wonderix opened #12404
  • Aug 19 14:20
    asterite closed #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:03
    asterite synchronize #12403
From IRC (bridge bot)
@FromIRC
<oprypin> in simple cases macros are evaluated before everything, but for example if you refer to the current type in the macro, that delays the expansion until the type's semantics are figured out
MB
@marceloboeira
macros need to be evaluated before everything but also after everything :⁠D
http://www.reactiongifs.com/wp-content/uploads/2013/10/tim-and-eric-mind-blown.gif
From IRC (bridge bot)
@FromIRC
<Papierkorb> Why
MB
@marceloboeira
just experimenting, I wanted to do it with macros, but then I've realised that it does not make any sense considering that you might have dynamic results
From IRC (bridge bot)
@FromIRC
<Papierkorb> For real code, you'd just rely on Nil
<Papierkorb> In your example, it'd simply be a Unsafe.new.io || "Empty..."
Cris Ward
@crisward
Just need 4,027 more stars to overtake ruby... https://github.com/showcases/programming-languages :wink:
MB
@marceloboeira
But considering everything can be nil,
Unsafe.new.io.foo.bar
you would have to
(((Unsafe.new.io || "default").foo) || "default_2").bar
From IRC (bridge bot)
@FromIRC
<Papierkorb> No
<Papierkorb> Everything can't be nil
MB
@marceloboeira
not everything, but the calls to unsafe things
IO related
From IRC (bridge bot)
@FromIRC
<Papierkorb> That's the whole point. Nil is a type on its own in Crystal. Try this: def foo(a : String); a; end; foo(nil) - Won't work
<Papierkorb> ..huh
<Papierkorb> IO is a type. If you expect an IO, or pledge to return an IO, you can only return that, no nil
<Papierkorb> Impossible. If you do find a way, it's a serious compiler bug
<RX14> if you do find a way you'll get segfaults lol
<Papierkorb> The only way to 'escape' having to return something matching the method prototype is raising an Exception. Another common theme is something like this: def read_input : String?; ...; end. It may return a String, or nil. In this case, the compiler will force you to work with the result in a type-safe manner
MB
@marceloboeira

e.g.:

User.where(foo: "bar").first.name

will never be nil?

From IRC (bridge bot)
@FromIRC
<Papierkorb> If #where, #first and #name are not nil-able, never.
<RX14> @marceloboeira have a pay with nil, you'll find out what works and what doesn't.
MB
@marceloboeira
you mean because of the nilable String?, ok, fair enough
From IRC (bridge bot)
@FromIRC
<Papierkorb> The type system of Crystal alone safes you from having to clutter your code with Just(x) etc.
John Jansen
@johnjansen
ok people, can someone point me at the solution to this on Ubuntu 16.04.2 LTS
$ crystal build test.cr --release
crystal: /var/cache/omnibus/src/llvm/llvm-3.8.1.src/lib/CodeGen/LexicalScopes.cpp:160: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion `cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed.
/usr/bin/crystal: line 102:  7523 Aborted                 (core dumped) "$INSTALL_DIR/embedded/bin/crystal" "$@"
From IRC (bridge bot)
@FromIRC
<Papierkorb> That is a compiler crash
<Papierkorb> Can you share the code?
Nick Franken
@fridgerator
@johnjansen its an issue with the latest build
crystal-lang/crystal#4719
John Jansen
@johnjansen
thanks @fridgerator, i feel another broken record coming on ;-)
Nick Franken
@fridgerator
lol
nah there is a workaround for this one
add --no-debug
John Jansen
@johnjansen
thanks, reading all that would have taken an age
Cris Ward
@crisward
@johnjansen Just tried compiling with --release and --no-debug and I'm get a strange bug where my app doesn't recognise '/' as a path. Will try and isolate the specific bug tomorrow.
John Jansen
@johnjansen
interesting
Cris Ward
@crisward
It's fine without --release, which means it's probably something to do with an llvm optimisation.
Rubi
@codenoid
morning ,,, :hatching_chick:
Rubi
@codenoid
btw gets method (from IO) wont work if i compile it with S E N T R Y
Dominic Muller
@domgetter
I can build just fine, but when I build --release, I'm getting this error: https://gist.github.com/domgetter/2da07138559cc4b86d3bcdbda66da398
Any thoughts?
John Jansen
@johnjansen
add —no-debug its a bug with 0.23.1
thats double dash
Dominic Muller
@domgetter
oh man I just had to scroll up 10 lines to see someone else with the issue. Thanks @johnjansen
John Jansen
@johnjansen
it was me ;-)
Dominic Muller
@domgetter
Now I can get back to figuring out why my SDL event handling is slow
bigDaddyS1oth
@bigDaddyS1oth
Hey all, it's been awhile. I'm on a new comfy Linux distro called Void and I'm installing Crystal from source, and I was curious if it's taken awhile for those of you who've done the same.
make is just taking awhile but I did give it the -si flags so that's probably why.
From IRC (bridge bot)
@FromIRC
<hightower2> Did you run it with -jX?
<hightower2> (If not that's another reason why it's taking a while ;⁠-)