What is nothrow for?

Yigal Chripun yigal100 at gmail.com
Fri Apr 25 14:19:03 PDT 2008


Janice Caron wrote:
> On 25/04/2008, Yigal Chripun <yigal100 at gmail.com> wrote:
>> if I understand you correctly, you want
> 
> No, I was merely postulating. It's not something I want, it was merely
> an example of something the compiler could do that a library add-on
> couldn't.
> 
>>  I'm not sure how the compiler can verify that at all due to polymorphism
>>  - the dynamic type of the instance will be known only at run-time.
> 
> Who cares? If I'm going to invent an arbitrary attribute, I can define
> it to do anything I want. Besides, structs have a "this", but not
> polymorphism, so the compiler could certainly check in the case of
> structs.
> 
> To give an even sillier example, a compiler could introduce a function
> attribute that meant "this function will not modify any variable
> starting with the letter x". I don't see how an add-on could do that
> through hooks.

I don't understand what you're trying to say here...
anyway, I've searched the Java docs to see How Java works with
annotations.I've found [1] which is a reflective API for build-time.
This API provides information about the source code of a program.

java 5 had a tool called apt that as of java 6 is part of the compiler,
it runs annotation processors on the code. (these are Java programs that
use the APIs in [1] and [2] and generate new source files)

[1]http://java.sun.com/javase/6/docs/jdk/api/apt/mirror/overview-summary.html
[2]http://java.sun.com/javase/6/docs/technotes/guides/apt/index.html

--Yigal



More information about the Digitalmars-d mailing list