DIP1000: Scoped Pointers (Discussion)

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 22 10:22:28 PDT 2016


On Mon, Aug 15, 2016 at 04:46:15PM -0700, Walter Bright via Digitalmars-d wrote:
> On 8/15/2016 4:30 PM, H. S. Teoh via Digitalmars-d wrote:
> > I'm looking forward to the day we have pervasive attribute
> > inferrence throughout the language.  It's the only sane way to deal
> > with attributes, because they inevitably grow unmanageably numerous.
> > In an ideal world I'd say *all* attributes should be inferred (and
> > only specified where the user wishes to ensure the attribute is
> > actually inferred). But in our non-ideal world it would be
> > interesting to see how far we can get.
> 
> I think we can pretty much get everywhere except for:
> 
> 1. virtual functions
> 2. explicit API interfaces

True.


> 3. separate compilation

Under the current state of separate compilation, yes.  But in theory it
*should* be possible, at least in some of the common use cases.


> 4. function pointers

But this shouldn't be a problem as long as the function itself is
covariant with the pointer?


> 5. recursion
[...]

I think it should be possible even with recursion, at least if there is
a non-recursive branch in the function(s). Of course, it may not
necessarily be *feasible* to implement the required analysis in the
compiler. But maybe for the simplest cases, e.g.:

	auto func(...) {
		if (condition)
			return finalResult;
		else
			return func(...);
	}


T

-- 
If Java had true garbage collection, most programs would delete themselves upon execution. -- Robert Sewell


More information about the Digitalmars-d mailing list