Re: Rob: Q: Constant Scope

new topic     » goto parent     » topic index » view thread      » older message » newer message

Vincent wrote:
> The ref manual says:
> "Constants may not be declared inside a subroutine." 
> "Constant declarations must be outside of any subroutine. Constants can
> be global or local, but not private."
> 
> Can you tell me why you made the language support only constant declera-
> tions at top-level, and not support it at routine level (private scope)?
> I'm just curious on why made it this way. What are the disadvantages?
> 
> I'm trying to figure out whether or not I want to add this functionability
> into my
> custom interpreter, and I wanted to know what you thought about
> it.

Here's something I wrote a few years ago, that discusses this issue
and a few other contentious issues:

http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=2&fromYear=7&toMonth=2&toYear=7&postedBy=rds&keywords=constant+scope+routine

In language design there is rarely a "right answer".
Things are very subjective.

> Another question... Is there anyway I can use global variables in
> Eu2C translated/compiled DLLs, being able to use define_c_var()?
> If not, could you consider, adding support for it in the next
> release? I tried making an example but it didnt work, maybe I did
> somthing wrong?

I have an example of define_c_var() in a Linux demo.
It lets the Euphoria program access a C variable in a shared library.
I don't know how well that works in the Windows world.
I think in Windows, it might only be routines that can be 
exported from a .dll, not variables. Maybe someone else here has tried it.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu