[Semi OT] Language for Game Development talk

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 27 15:30:41 PDT 2014


Walter Bright:

> * local functions with the same syntax as global functions
>
> * safety which defaults to off
>
> All of which D does right now.

It could be nice to have a syntax like lambdas for small 
struct/class methods:
https://issues.dlang.org/show_bug.cgi?id=7176

struct Foo {
     int bar(int x) pure { return x * x; }
}

Becomes something like::

struct Foo {
     int bar = (int x) pure => x * x;
}

Ada2012 and C#6 have something like that (with a different 
syntax).


> 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.

Unwanted access of global variables is a common source of 
troubles in my code. Time ago I suggested an optional @outer() 
function annotation:
https://d.puremagic.com/issues/show_bug.cgi?id=5007

Bye,
bearophile


More information about the Digitalmars-d mailing list