June 02, 2013
Why pure is keyword, but @safe is attribute?
June 02, 2013
On Sunday, June 02, 2013 10:52:14 Michael wrote:
> Why pure is keyword, but @safe is attribute?

They're both function attributes. But pure is a keyword and safe got @ tacked onto the front of it in order to avoid having to create a new keyword. Now, we have User Defined Attributes which also use @, but that doesn't really have anything to do with @safe or any of the other function attributes which start with @ save for the fact that a UDA obviously can't have the same name. @safe could have just as easily been safe, and pure could just as easily have been @pure. But it was arbitrarily chosen that pure didn't have @ and @safe did. I believe that it's at least partially based on when they were added to the language, but it's ultimately arbitrary, and the fact that @safe starts with @ means nothing.

- Jonathan M Davis