Why the @ in @safe? & UDAs

Timothee Cour thelastmammoth at gmail.com
Sun Nov 10 12:31:08 PST 2013


This is exactly what I suggested at Dconf, and this is what go has done
with go fix:
http://golang.org/cmd/fix/
so it can definitely be done. After using that, user can just use git diff
and see summary of changes if he wants. That is *the* path to improving D's
API. Code with source can be changed, compiled code without source doesn't
need to be changed.
The discussion should focus on how to help with harder cases involving
string mixins found while executing CTFE.
Btw, refactoring code with AST macros should be easier than with string
mixins.


On Sun, Nov 10, 2013 at 11:36 AM, Adam D. Ruppe
<destructionator at gmail.com>wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131110/72cf6a40/attachment.html>


More information about the Digitalmars-d mailing list