Why D Needs Attributes (Was: Command-line arguments)
Dee Girl
deegirl at noreply.com
Fri Jul 4 22:05:39 PDT 2008
Nick Sabalausky Wrote:
> "superdan" <super at dan.org> wrote in message
> news:g4mmed$a2u$1 at digitalmars.com...
> > Robert Fraser Wrote:
> >
> >> superdan wrote:
> >> > narp. getopt is better for 2 reasons. first, if i want to have an
> >> > option with a dash in it, with getopt you say;
> >> >
> >> > bool showControlChars;
> >> > getopt(args, "show-control-chars", &showControlChars);
> >> >
> >> > i and you and anyone who's used getopt once knows how to do that. but i
> >> > have no idea how to do that in c#. there may be some shitty attribute
> >> > to do so but i have to go check the manual. who wins?
> >>
> >> So, just to be clear, your argument is "I don't understand the C# way,
> >> so getopt is better"?
> >
> > narp you are confused. there must be some option in the c# attributes that
> > tells how to do conversion from dashes to non-dashes. my point was that
> > that needs to be looked up whether or not you are versed in c# proper.
> > with std.getopt you don't need to look that up because the string is
> > distinct from the variable it binds to.
> >
>
> getopt has plenty of options that need to be looked up.
Hello Nick. Sorry maybe I came in thread late. I disagree, std.getopt has 7 options and a few syntax. many options are "no" for other options. If I understand what super dan write, I think he has a good points. There is repeat a little but it is small price for simplicity of library. And I disagree when you said that just wrap class {} around variables is not important. it is very important. more types should not add without necessity. I have some variable in main() that I parse and maybe few globals. Why put they all in a class? It is not wanted complexity not justified.
Also the modular part is not good argument. Code to handle command line is unique, never called from the app. Only once. Should be there in line. Design for modular there is not justified. I think even is mistake. Parse arguments is simple problem and should have simple solution. std.getopt is simple solution. (only one function!) All other are complicated. It means they did not see how simple problem is. Thank you, Dee Girl
More information about the Digitalmars-d
mailing list