> For now I have defined functions meant to be overridden by user as 
> functions with empty body. However I'd like to issue some diagnostics if 
> these empty functions are called, either at compile- or runtime. 
> Something along the lines of die("message") or exit("message"). I tried 
> compilerError, but apparently it generates an error regardless whether 
> the method is overridden or not.

Ultimately what we need here is a true notion pure virtual methods in the 
language, but see the apology below about "naive OOP support".


compilerError() is triggered at compile-time any time the compiler tries 
to resolve that function call, so using it in dynamic dispatch cases is 
not the right way to go, at least as the compiler is currently implemented 
(it'll analyze a virtual method whether or not all child classes override 
it).  So typically in these cases, we insert a halt() in the pure virtual 
method which will result in an execution-time error.  Not as ideal as a 
compile-time error, but our only option I'm aware of until pure virtual 
methods are supported.

-Brad


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to