Think you for reply! It is my first post at google group, as I am not good 
at english.

 I am a embedded programer, use C language as  major language. I maintain 
about 30+ projects, most of them is similar, just has little different. 
Some time that diffrents is hard to use C marco to handle it . So I as that 
question, if I can use Leo node as function and generate that differents 
part, it is perfect. It seem like Leo act as writing DSL, and other format 
document is the output. That is what I real to want.

Thinks again, for your reply!

在 2016年8月18日星期四 UTC+8下午9:03:01,Edward K. Ream写道:
>
> On Thu, Aug 18, 2016 at 6:44 AM, <[email protected] <javascript:>> wrote:
>
>> If I write add a node name "@function say_hi( name)", node content like 
>> "ret
>> ​​
>> u
>> ​r​
>> n "Hi " + name + " !" ", I can invoke it like below:
>>
>> @func
>> ​t​
>> ion say_hi("zenkoo"), finally the text is "Hi zenkoo!". If leo has this 
>> feature, that is very cool.
>>
>
> ​Thanks for this question.  It's interesting.​ Afaik, there is nothing 
> exactly like this in Leo.
>
> First, let me warn you that certain solutions might have serious security 
> consequences.  For example, you could define functions in nodes using 
> @script 
> <http://leoeditor.com/scripting-miscellany.html#modifying-plugins-with-script-scripts>.
>  
> It doesn't seem well documented, but @script is a security concern, and so 
> is disabled by default.
>
> Second, scripts may define code that can be used later as follows:
>
>     exec(g.findTestScript(c,'my_commands'))
>     << code that uses my_commands >>
>
> Again, this could be a security concern because this script is executing 
> unknown code (the code in the node whose headline is "my_commands").
>
> In general, however, it is not necessary to do what you are asking, for 
> several reasons:
>
> 1. Typically, code of whatever kind (plugins, modules, scripts) can use 
> Python's import command to import common code.
>
> 2. For complex Leo scripts, I recommend a top-level that looks something 
> like this:
>
>    << imports >>
>    @others # defines Controller class in subtree
>    x = Controller(c)
>    x.run()
>
> This is a simple, flexible, powerful pattern that can be used to define 
> huge scripts.
>
> In short, your question is interesting, but I'm not aware of any real 
> reason to want to do what you are asking.  Feel free to ask more questions.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to