On Mon, 2007-07-23 at 22:27 +1000, skaller wrote:
> On Mon, 2007-07-23 at 18:59 +1000, Rhythmic Fistman wrote:
> > I use spawn_fthread a lot and it gets a bit of a hassle to write
> > and read. Can I define a very short macro, say "p" that expands
> > to spawn_fthread or do I have to write a new proc?
>
> Sure, you could use a macro, eg:
>
> val st = spawn_fthread;
Oops, I meant
macro val st = spawn_fthread;
You can also try this:
////////////////////////////////////////
#import <flx.flxh>
#keyword st
syntax fthreads {
statement := st statement =>#
"""
`(ast_call ,_sr (ast_name "spawn_fthread" ())
(ast_lambda (,dfltvs ((() none)) none (,_2))))
"""
;
statement := [ statement ] =>#
"""
`(ast_call ,_sr (ast_name "spawn_fthread" ())
(ast_lambda (,dfltvs ((() none)) none (,_2))))
"""
;
}
open syntax fthreads;
st println "Hello";
[ println "bye"; ]
///////////////////////////////////////////
Well, the scheme action for that is a bit messy.
But flxp tells me this translates to:
call spawn_fthread (fun () = {
call println "Hello";
});
call spawn_fthread (fun () = {
call println "bye";
});
and it prints:
[EMAIL PROTECTED]:/work/felix/svn/felix/felix/trunk$ f ft
//Parsing Implementation std.flx
//Parsing Implementation ft.flx
bye
Hello
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language