data = NamedTuple.new(name:String, nickname:String)
data[:name] = name.to_s if name #only assign if name exists
data[:nickname] = nickname.to_s if nickname #only assign if nickname exists
From IRC (bridge bot)
@FromIRC
<Papierkorb> In best case, not at all
<Papierkorb> NamedTuple are immutable data structures, with keys known at compile-time.
<Papierkorb> If you need something mutable, use a Hash
Claudio Holanda
@kazzkiq
Hmmmm, will try that.
Rubi
@codenoid
PCRE does not support \L, \l, \N{name}, \U, or \u at 2
piperun
@piperun
Hello everyone, I'm a little curious about crystal, as far as I know it's a compiled language but I'm wondering if it's possible to use Crystal as a script language in say making video games?
From IRC (bridge bot)
@FromIRC
<tosmi> hi, i'm trying to compile crystal on freebsd 10.3
<tosmi> following the comment in crystal-lang/crystal#4185, i'm using the 0.19 freebsd binary to build 0.20.0
<tosmi> gmake works, but call gmake spec or running gmake a second time yields the following error message
<tosmi> any hints what i'm donig wrong here? thanks
Bar Hofesh
@bararchy
@piperun there are more then a few people doing game development in Crystal , I don't really understand the Script part in the question though
Johannes Müller
@straight-shoota
I think @piperun want's to use Crystal as an interpreted language to easily allow custom modifications.
This would be very difficult and probably not really helpful, because Crystal's type inference for example needs to assess the whole program and not just parts of it.
Johannes Müller
@straight-shoota
@tosmi I don't know if it helps, but does src/lib_c/x86_64-portbld-freebsd/c/dlfcn.cr exist?
Oh I see you figured that^^
piperun
@piperun
@straight-shoota I see, thanks for the input!
Johannes Müller
@straight-shoota
you could probably better use Lua (or somthing similar, maybe mruby). This language was explicitly designed for such tasks. IIRC there are Crystal bindings for liblua.
<tosmi> but it seems my problem is related with the crystal standard library
<tosmi> maybe there's no merge! for Set(string) in 0.20.0 but 0.20.1 uses this
<tosmi> so how do i compile crystal 0.20.1 with 0.20.0?
Akzhan Abdulin
@akzhan
it looks like you got wrong source code: 0.20.1 stdlib introduces merge! method
Johannes Müller
@straight-shoota
but you should be able to compile 0.20.1 with 0.20.0
From IRC (bridge bot)
@FromIRC
<tosmi> i'm using bash here and after compiling 0.20.0 i did a export PATH=.../crystal-0.20.0/bin and tried to compile 0.20.1
<tosmi> seems to be wrong...
<tosmi> so my workflow is setting the path, changing to the new crystal version and running gmake
Johannes Müller
@straight-shoota
I guess you could just keep everything in the same directory... make builds compiler into .build/crystal, then checkout next release and make uses .build/crystal from previous build
From IRC (bridge bot)
@FromIRC
<tosmi>@straight-shoota: thanks! looks like that's the issue here. i will try that a little bit later