ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 255 seconds]
notzmv has quit [Read error: Connection reset by peer]
notzmv has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
<FromGitter>
<riffraff169> just a question: c varargs no, but is it possible to link to a c function that accepts varargs, but you dont pass varargs...so you would create a crystal function for each variant you want...
<FromGitter>
<riffraff169> if you only need one, you would create the static (sort of) crystal function, pass the data to the varargs c function statically, but the c function would do its varargs thing with your data...
<FromGitter>
<riffraff169> i hope that was clear
notzmv has quit [Ping timeout: 252 seconds]
notzmv has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
<Guest64>
hey, is it possible for a crystal macro to edit other portions of the code base when called? for example, i have a macro that defines a proc, but i also want to append the procs name to a case clause in another def method. so that each time the macro is called, it creates the proc, but also adds it to the list of when clauses
<FromGitter>
<riffraff169> you could probably have a macro create another source file to be added to the list of files to be compiled and linked...that file will define the method
<FromGitter>
<riffraff169> maybe
<Guest64>
hmm, i will try exploring that avenue. i was also thinking perhaps a macro calling a macro might work, in which the second macro might define the when clause. id have to play with it later
<Guest64>
as a side question: is there a cleaner way to create default args
<Guest64>
from a splat of types for a macro? for example if *types contains
<Guest64>
{Int32, Int32}, when the macro defines a definition i use: def my_def({%
<Guest64>
for type, index in args %}arg{{index}} : {{type}},{% end %}) which
<Guest64>
expands to def my_def(arg0 : Int32, arg1 : Int32)
sorcus has joined #crystal-lang
<FromGitter>
<Blacksmoke16> You can append them to a constant, then iterate over it in a finished hook
<FromGitter>
<Blacksmoke16> But im not really sure you need a macro here, versus just a method and hash of procs