Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 9622 - Range violation in rdmd #47

Merged
merged 1 commit into from
Mar 1, 2013
Merged

Conversation

andralex
Copy link
Member

@andralex andralex commented Mar 1, 2013

alexrp added a commit that referenced this pull request Mar 1, 2013
Fix issue 9622 - Range violation in rdmd
@alexrp alexrp merged commit 9fc4f6a into dlang:master Mar 1, 2013
@@ -41,7 +41,7 @@ private string compiler = defaultCompiler;

int main(string[] args)
{
//writeln("Invoked with: ", map!(q{a ~ ", "})(args));
//writeln("Invoked with: ", args);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to point out that If you really want a comma separated list in text format, then the "best" (easiest) way would be using the formatted write with list syntax:

    writefln("Invoked with: %(%s, %).", args);
rdmd main.d hello "C:\My Folder" world
Invoked with: "main.exe", "hello", "C:\\My Folder", "world".

Using the "raw" range means you data will be "bracket enclosed":

Invoked with: ["main.exe", "hello", "C:\\My Folder", "world"].

The code is commented, so it doesn't matter much anyways, but just wanted to point it out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good point. This reminds me I've forever wanted to add a %D format specifier to format that causes data to be formatted closest to a D data definition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what %s does by default when there is no provided toString function, right? The point of %D would be to explicitly bypass the toString?

I think this thread I just started in learn is actually specifically asking for this feature:
http://forum.dlang.org/thread/lljftxptrgrltcpaszgf@forum.dlang.org

Basically, I want to print a string according to how it would look in D.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah, the simplest case is printing a string with escaped characters etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants