On Sun, Aug 21, 2005 at 12:11:17 +0000, Ingo Blechschmidt wrote:
> Hi, 
>  
> Yuval Kogman <nothingmuch <at> woobling.org> writes: 

> But we should note that some backends don't generate meaningful 
> ASTs, simply because they don't convert PIL -> target language 
> AST -> target language, but PIL -> target language directly. I.e. 
>  
>     my $ast = $code.emit(..., :language<Foo>); 
>     say keys $ast;      # "FooCode" 
>     say $ast<FooCode>;  # ... 
>  
>     my $ast = { 3 + 4 }.emit(..., :language<PIL>); 
>     say $ast.pBody.pStmt.pExpr.pLV.pArgs[1].pLit.pVal;  # 4 
>  

In that case they just take the PIL tree and rebless it with the
code emitter as the stringifier.

> There could be a module JavaScript::Browser or so, which would 
> export $*DOM. I.e.: 
>  
>     #!/usr/bin/pugs 
>     $*DOM.document.write(...); 
>     # Compile-time error: $*DOM not declared 
>  
>     #!/usr/bin/pugs -BParrot 
>     use JavaScript::Browser <$*DOM>; 
>     $*DOM.document.write(...); 
>     # error: $*DOM does only work when running in a browser 
>  
>     #!/usr/bin/pugs -CJS 
>     use JavaScript::Browser <$*DOM>; 
>     $*DOM.document.write(...); 
>     # fine now 
>  
> This exported $*DOM object could then be a (proxy) object with 
> appropriate magic -- i.e. die when the current runtime is not 
> a browser and relay all calls to the respective native JavaScript 
> objects otherwise. 
>  
> I think something like "$*DOM is exported" is too generic, 
> not sure... 

Yes, you're absolutely right.

-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me spreads pj3Ar using 0wnage: neeyah!!!!!!!!!!!

Attachment: pgpDFO1VuzNuF.pgp
Description: PGP signature

Reply via email to