The Crystal programming language | http://crystal-lang.org | Fund Crystal's development: http://is.gd/X7PRtI | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/
@guest64 --
module MyProcs
Proc1 = ->(arg0 : Int32, arg1 : Int32) { arg0 + arg1 }
end
module MyProcs
Proc2 = ->(arg0 : String, arg1 : String) { arg0.to_i64 + arg1.to_i64 }
end
macro build_a_hash
{%
foo = {} of Nil => Nil
MyProcs.constants.each do |const|
foo[const.stringify] = "MyProcs::#{const.id}".id
end
%}
MyHash = {{ foo.stringify.id }}
end
build_a_hash
pp MyHash
pp typeof(MyHash)
You are still going to have problems with types, though, if you have a single hash that holds everything.
Try it and you will see what I mean.
@[Measure]
def foo
end
macro finished
{% for meth in ... %}
def {{meth...}}
slot = {{ slot_for @type, meth.name }}
Fiber.current.measurements[slot].measure do
previous_def
end
end
{% end %}
end
previous_def
is the important part. require "socket"
doesn't seem to help. Is this a load order problem or issue with modules? https://carc.in/#/r/bj8y
FileDescriptor
should because it includes the module, so it should deff have that method
super
@Blacksmoke16 and all who responded to my raspberry pi madness: I finally got 1.0 to compile on a model 4b with 4gb ram. Why? Why not. After setting al the environment stuff, it works like a charm. I did have to compile llvm-10 for the rpi which was 'painfull' - almost 10 hours! I kept notes if anyone is interested - I consolidated a lot of stuff from online plus community help. A big thanks to everyone
Crystal 1.0.0 ()
LLVM: 10.0.0
Default target: arm-unknown-linux-gnueabihf
Still missing the compile date, but it works along with shards 0.15.0.
File.match?
accepts a String
or Path
as path
, but match_single_pattern
only accepts String
even if you have
*args
it just comes up asargs
, so not sure if you'd be able to tell that arg is a splat. so think this could deff be improved a bit
that just points to it not being meant for this use case