Why the @ in @safe? & UDAs
Adam D. Ruppe
destructionator at gmail.com
Sun Nov 10 11:36:36 PST 2013
On Sunday, 10 November 2013 at 19:30:30 UTC, Michael wrote:
> search/replace regexp ?)
I think the way I'd do it is combine that with the compiler. So
you compile your code. The compiler generates an error. The fixup
script checks the errors against the pattern it has and then does
the necessary changes on the file, then writes it back out
(perhaps doing a backup and/or user confirmation, like replacing
files on a copy: yes, no, yes to all, with yes to all just
following that same pattern - if it is a different class of error
message, or if the replace would replace two things when it
should only be one, it asks for confirmation again)
This actually shouldn't be too hard to write for quite a few
things, and using actual errors would be more reliable than a
plain find/replace.
The interactive session can go pretty fast
$ fixup
error foo.d line 30 undefined identifier safe
@safe void foo() {
replace with
safe void foo() { # BTW I'd highlight the replacement in color
too
y/n/yes to all/no to all? yes to all
boom
More information about the Digitalmars-d
mailing list