www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12954] New: deprecated doesn't work with concatenated strings


          Issue ID: 12954
           Summary: deprecated doesn't work with concatenated strings or
                    anything else but a string literal
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: jmdavisProg gmx.com

This code:

deprecated("my " ~ "message")
void foo()

void main()

gives this error

q.d(1): Error: string expected, not '"my " ~ "message"'

This code gives a similar error:

string bar()
    return "my message";

void foo()

void main()

I would have expected that deprecated would take any arbitrary expression which
evaluated to a string at compile time. I'm not sure that it really matters that
you can pass it a function (save for consistency with other language features),
but the lack of ~ makes it hard to break up lines if you end up with a long
deprecation message (and yes, it's generally better to have shorter deprecation
messages, but sometimes longer ones are required, and it would be better if
they didn't have to be on one, overly long line).

Jun 19 2014