[Semi OT] Language for Game Development talk

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 27 15:04:07 PDT 2014


On Sat, Sep 27, 2014 at 02:51:14PM -0700, Walter Bright via Digitalmars-d wrote:
[...]
> The only interesting thing is he describes a way that functions (and
> blocks) can specify what global data they access, and then have the
> compiler issue errors for accessing any other global data. He has a
> way to do that both locally and transitively.

That sounds like PHP. *shudder*


> However, the same effect can be achieved via pure annotations and
> passing the globals needed by reference as function parameters.
[...]

I'm a fan of grouping related globals into structs with module level
instances, and passed by reference to functions that need those specific
globals. Truly-global globals are nasty, as are open sets of globals
where you either don't access a global, or you (potentially) access
*all* globals with no finer access granularity. (I had to debug C code
that did that once... boy it was mind-bending when every function call
could potentially arbitrarily change the global state.)


T

-- 
Computers are like a jungle: they have monitor lizards, rams, mice, c-moss, binary trees... and bugs.


More information about the Digitalmars-d mailing list