If you could change the C or C++ or Java syntax, what would you like different?

Discussion in 'C++' started by Alexander, Oct 8, 2010.

  1. Alexander

    Alexander Guest

    Please share your oppinion on anything you do not like in the C or C++
    or Java syntax (they're quite similar).

    In order to maintain the integrity of the discussion (have everything
    at the same place) please respond on comp.lang.c.

    Cheers,
    Alexander
     
    Alexander, Oct 8, 2010
    #1
    1. Advertising

  2. Re: If you could change the C or C++ or Java syntax, what would youlike different?

    Alexander wrote:
    > Please share your oppinion on anything you do not like in the C or C++
    > or Java syntax (they're quite similar).
    >
    > In order to maintain the integrity of the discussion (have everything
    > at the same place) please respond on comp.lang.c.
    >
    > Cheers,
    > Alexander


    ....and thus began a long, pointless and heated debate :)

    Doesn't sound like a good plan to me:

    1) It will annoy the regulars in comp.lang.c with lots of off-topic
    stuff about C++ and Java.
    2) It won't be actionable -- if you were serious about changing the
    syntax, you'd need to get on the standards committees and spend about a
    decade of effort working on the details.
    3) The syntax of each of the languages is different (despite a certain
    amount they have in common) -- it's very hard to have a productive
    discussion about three different languages at once.

    If I were a betting man, I'd say you were a troll.

    Regards,
    Stu
     
    Stuart Golodetz, Oct 8, 2010
    #2
    1. Advertising

  3. Alexander

    red floyd Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Oct 8, 12:43 pm, Stuart Golodetz <> wrote:
    > Alexander wrote:
    > > Please share your oppinion on anything you do not like in the C or C++
    > > or Java syntax (they're quite similar).

    >
    > > In order to maintain the integrity of the discussion (have everything
    > > at the same place) please respond on comp.lang.c.

    >
    > > Cheers,
    > > Alexander

    >
    > ...and thus began a long, pointless and heated debate :)
    >
    > Doesn't sound like a good plan to me:
    >
    > 1) It will annoy the regulars in comp.lang.c with lots of off-topic
    > stuff about C++ and Java.
    > 2) It won't be actionable -- if you were serious about changing the
    > syntax, you'd need to get on the standards committees and spend about a
    > decade of effort working on the details.
    > 3) The syntax of each of the languages is different (despite a certain
    > amount they have in common) -- it's very hard to have a productive
    > discussion about three different languages at once.
    >
    > If I were a betting man, I'd say you were a troll.


    Or else some guy posting his homework question.
     
    red floyd, Oct 8, 2010
    #3
  4. Alexander

    Lew Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    Alexander wrote:
    >>> Please share your oppinion on anything you do not like in the C or C++
    >>> or Java syntax (they're quite similar).


    I don't like the way people start flame wars about something that doesn't
    amount to a hill of beans in this world.

    >>> In order to maintain the integrity of the discussion (have everything


    *What* integrity?

    >>> at the same place) please respond on comp.lang.c.


    Stuart Golodetz wrote:
    >> ...and thus began a long, pointless and heated debate :)
    >>
    >> Doesn't sound like a good plan to me:
    >>
    >> 1) It will annoy the regulars in comp.lang.c with lots of off-topic
    >> stuff about C++ and Java.
    >> 2) It won't be actionable -- if you were serious about changing the
    >> syntax, you'd need to get on the standards committees and spend about a
    >> decade of effort working on the details.
    >> 3) The syntax of each of the languages is different (despite a certain
    >> amount they have in common) -- it's very hard to have a productive
    >> discussion about three different languages at once.
    >>
    >> If I were a betting man, I'd say you were a troll.


    red floyd wrote:
    > Or else some guy posting his homework question.


    I wouldn't bet against Stuart. The question doesn't really smell like
    homework, but it reeks of troll doo-doo.

    --
    Lew
    If you get on this discussion, you're going to regret it. Oh, not right away,
    but soon and for the rest of your life.
     
    Lew, Oct 8, 2010
    #4
  5. Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On 10/08/2010 03:09 PM, Alexander wrote:
    > Please share your oppinion on anything you do not like in the C or C++
    > or Java syntax (they're quite similar).


    Let me try int &c in C, List<List<Foo>> in C++, or int *x; in Java. Oh wait.

    There is a not-insignificant amount of difference between C, C++, and
    Java. The primary things that are really the same between the languages
    is the use of curly braces for scope definition, semicolon-terminated
    statements, the use of `\' as an escape character, and the function
    calling syntax of func(args). The latter two are common even in those
    languages which are not curly-braced delimited (e.g., python), and
    aren't really anything that people would complain about.

    That pretty much leaves the curly-brace-delimited and
    semicolon-delimited natures as the only truly common parts of syntax
    which are arguable, and probably anyone who would be inhabiting these
    newsgroups are not going to be arguing against those.

    I would like to note that many of my... issues with C++ and Java
    syntaxes are of those constructs which are (more or less) unique to
    those languages [1], so "they're quite similar" isn't good enough.

    > In order to maintain the integrity of the discussion (have everything
    > at the same place) please respond on comp.lang.c.


    That sounds nice until you realize that many people on the other
    newsgroups don't follow comp.lang.c, such as yours truly.

    [1] Java generics and C++ templates are sufficiently different that I am
    going to call them unique constructs.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Oct 9, 2010
    #5
  6. Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Oct 8, 6:26 pm, Lew <> wrote:
    > red floyd wrote:
    > Stuart Golodetz wrote:
    > > > If I were a betting man, I'd say you were a troll.

    > > Or else some guy posting his homework question.

    >
    > I wouldn't bet against Stuart.  The question doesn't really smell like
    > homework, but it reeks of troll doo-doo.


    I'd bet on a guy with "I'm gonna design a better
    language and write a compiler" day dreams.

    KHD
     
    Keith H Duggar, Oct 9, 2010
    #6
  7. Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Fri, 08 Oct 2010 12:09:19 -0700, Alexander wrote:

    > Please share your oppinion on anything you do not like in the C or C++
    > or Java syntax (they're quite similar).
    >
    > In order to maintain the integrity of the discussion (have everything at
    > the same place) please respond on comp.lang.c.
    >
    > Cheers,
    > Alexander


    Ahh. <grabs popcorn> <lies back>

    ....

    <munch, munch>

    Er, where's all the action?

    What, only five replies? What, nobody's even SUGGESTED operator
    overloading in Java yet? Waaah, where's the flamewar!? I feel like I sat
    down in the theatre to watch a Jean Claude Van Damme movie and so far it
    more resembles the Ya-Ya Sisterhood of Traveling Bra-Straps III or
    whatever the latest damn chick flick is called.

    Okay, then, I guess it's up to me. I've got to stop lurking and take
    action. A man's gotta do what a man's gotta do.

    Lisp macros and first-class lambdas. In all three languages.
     
    ClassCastException, Oct 10, 2010
    #7
  8. In comp.lang.c++ ClassCastException <> wrote:
    > What, only five replies? What, nobody's even SUGGESTED operator
    > overloading in Java yet?


    I think the question was about *syntax*, not features. In other words,
    which of the *existing* features of the language would you prefer being
    able to write using a different syntax.
     
    Juha Nieminen, Oct 10, 2010
    #8
  9. >>> Please share your oppinion on anything you do not like in the C or C++
    >>> or Java syntax (they're quite similar).
    >>>
    >>> In order to maintain the integrity of the discussion (have everything at
    >>> the same place) please respond on comp.lang.c.

    >> Ahh. <grabs popcorn> <lies back>


    >>
    >> Lisp macros and first-class lambdas. In all three languages.


    A construct that allows explicit transfer of control to another statement in
    order to create control structures more complex than if-then-else or
    while-do. Call it "past", e.g.

    try
    {
    a:
    process();
    }
    catch (Exception ex)
    {
    log(ex);
    reinit();
    past a; // i.e. transfer control to the statement just past the
    label a
    }

    A method which uses this construct can be called "past a" code.
     
    Mike Schilling, Oct 11, 2010
    #9
  10. Alexander

    Tom Anderson Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Sun, 10 Oct 2010, Mike Schilling wrote:

    > A construct that allows explicit transfer of control to another
    > statement in order to create control structures more complex than
    > if-then-else or while-do. Call it "past", e.g.
    >
    > try
    > {
    > a:
    > process();
    > }
    > catch (Exception ex)
    > {
    > log(ex);
    > reinit();
    > past a; // i.e. transfer control to the statement just past the label a
    > }
    >
    > A method which uses this construct can be called "past a" code.


    As an entirely unrelated aside, why is it that some Americans insist on
    referring to all kinds of pasta as spaghetti?

    tom

    --
    .... and the children still cry "Make mine a 99"
     
    Tom Anderson, Oct 11, 2010
    #10
  11. Alexander

    Lew Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    Tom Anderson wrote:
    > As an entirely unrelated aside, why is it that some Americans insist on
    > referring to all kinds of pasta as spaghetti?


    For the same reason they call DVDs "tapes" and they "dial" pushbutton phones?

    Metonymy, historicity,
    not-giving-a-hoot-about-the-difference-between-rotini-and-farfalle-y?

    --
    Lew
     
    Lew, Oct 11, 2010
    #11
  12. Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On 10/11/2010 02:18 AM, Mike Schilling wrote:
    > A construct that allows explicit transfer of control to another
    > statement in order to create control structures more complex than
    > if-then-else or while-do. Call it "past", e.g.


    Don't worry, with BGGA closures, you could probably implement this.

    In all seriousness, being able to continue execution from certain
    exceptions (like smalltalk's exceptions can do) would be helpful at
    times. I can't think of any instances where I wanted to do this off the
    top of my head, though.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Oct 11, 2010
    #12
  13. "Joshua Cranmer" <> wrote in message
    news:i8uucc$kpd$...
    > On 10/11/2010 02:18 AM, Mike Schilling wrote:
    >> A construct that allows explicit transfer of control to another
    >> statement in order to create control structures more complex than
    >> if-then-else or while-do. Call it "past", e.g.

    >
    > Don't worry, with BGGA closures, you could probably implement this.
    >
    > In all seriousness, being able to continue execution from certain
    > exceptions (like smalltalk's exceptions can do) would be helpful at times.
    > I can't think of any instances where I wanted to do this off the top of my
    > head, though.


    In _The Design and Evolution of C++_, Stroustrup makes almost exactly this
    point. Some exception-handling systems, like VMS's, provided this ability,
    but few people used it, and those who did often later removed it as
    error-prone. which is why he didn't include it in C++.
     
    Mike Schilling, Oct 11, 2010
    #13
  14. Alexander

    Tom Anderson Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Mon, 11 Oct 2010, Mike Schilling wrote:

    > "Joshua Cranmer" <> wrote in message
    > news:i8uucc$kpd$...
    >> On 10/11/2010 02:18 AM, Mike Schilling wrote:
    >>> A construct that allows explicit transfer of control to another
    >>> statement in order to create control structures more complex than
    >>> if-then-else or while-do. Call it "past", e.g.

    >>
    >> Don't worry, with BGGA closures, you could probably implement this.
    >>
    >> In all seriousness, being able to continue execution from certain
    >> exceptions (like smalltalk's exceptions can do) would be helpful at times.
    >> I can't think of any instances where I wanted to do this off the top of my
    >> head, though.

    >
    > In _The Design and Evolution of C++_, Stroustrup makes almost exactly this
    > point. Some exception-handling systems, like VMS's, provided this ability,
    > but few people used it, and those who did often later removed it as
    > error-prone. which is why he didn't include it in C++.


    Stroustrup *didn't* include something in C++ because it was error-prone?
    Was he having an off day or something?

    Tom

    --
    It is big (I didn't realise how big 17" is) -- Martin
     
    Tom Anderson, Oct 11, 2010
    #14
  15. Alexander

    Seebs Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On 2010-10-11, Tom Anderson <> wrote:
    > As an entirely unrelated aside, why is it that some Americans insist on
    > referring to all kinds of pasta as spaghetti?


    I have no idea. The generic term I use for pasta is "metalini"*, I consider
    something spaghetti only if it's long, round, and a bit thicker than Angel
    Hair.

    -s
    [*] Pasta-shaped pasta, of course.
    --
    Copyright 2010, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
    I am not speaking for my employer, although they do rent some of my opinions.
     
    Seebs, Oct 11, 2010
    #15
  16. Alexander

    Jim Janney Guest

    Joshua Cranmer <> writes:

    > On 10/08/2010 03:09 PM, Alexander wrote:
    >> Please share your oppinion on anything you do not like in the C or C++
    >> or Java syntax (they're quite similar).

    >
    > Let me try int &c in C, List<List<Foo>> in C++, or int *x; in Java. Oh wait.
    >
    > There is a not-insignificant amount of difference between C, C++, and
    > Java. The primary things that are really the same between the
    > languages is the use of curly braces for scope definition,
    > semicolon-terminated statements, the use of `\' as an escape
    > character, and the function calling syntax of func(args). The latter
    > two are common even in those languages which are not curly-braced
    > delimited (e.g., python), and aren't really anything that people would
    > complain about.
    >
    > That pretty much leaves the curly-brace-delimited and
    > semicolon-delimited natures as the only truly common parts of syntax
    > which are arguable, and probably anyone who would be inhabiting these
    > newsgroups are not going to be arguing against those.
    >
    > I would like to note that many of my... issues with C++ and Java
    > syntaxes are of those constructs which are (more or less) unique to
    > those languages [1], so "they're quite similar" isn't good enough.
    >
    >> In order to maintain the integrity of the discussion (have everything
    >> at the same place) please respond on comp.lang.c.

    >
    > That sounds nice until you realize that many people on the other
    > newsgroups don't follow comp.lang.c, such as yours truly.
    >
    > [1] Java generics and C++ templates are sufficiently different that I
    > am going to call them unique constructs.


    I would use = for comparison and := for assignment. You could argue
    that this is lexical structure rather than syntax, but it's common to
    all three languages.

    --
    Jim Janney
     
    Jim Janney, Oct 11, 2010
    #16
  17. Alexander

    Jorgen Grahn Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    ["Followup-To:" header set to comp.lang.c++.]

    On Mon, 2010-10-11, Tom Anderson wrote:
    > On Mon, 11 Oct 2010, Mike Schilling wrote:
    >
    >> "Joshua Cranmer" <> wrote in message
    >> news:i8uucc$kpd$...
    >>> On 10/11/2010 02:18 AM, Mike Schilling wrote:
    >>>> A construct that allows explicit transfer of control to another
    >>>> statement in order to create control structures more complex than
    >>>> if-then-else or while-do. Call it "past", e.g.
    >>>
    >>> Don't worry, with BGGA closures, you could probably implement this.
    >>>
    >>> In all seriousness, being able to continue execution from certain
    >>> exceptions (like smalltalk's exceptions can do) would be helpful at times.
    >>> I can't think of any instances where I wanted to do this off the top of my
    >>> head, though.

    >>
    >> In _The Design and Evolution of C++_, Stroustrup makes almost exactly this
    >> point. Some exception-handling systems, like VMS's, provided this ability,
    >> but few people used it, and those who did often later removed it as
    >> error-prone. which is why he didn't include it in C++.

    >
    > Stroustrup *didn't* include something in C++ because it was error-prone?
    > Was he having an off day or something?


    Read the book. He describes his (and others') way of reasoning and the
    massive field experience he collected in order to make a decision.
    And your sarcasm falls flat compared to it.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, Oct 11, 2010
    #17
  18. Alexander

    Richard Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    [Please do not mail me a copy of your followup]

    Jorgen Grahn <> spake the secret code
    <> thusly:

    >Read the book. He describes his (and others') way of reasoning and the
    >massive field experience he collected in order to make a decision.


    Given that this was published in 1994 and C++ has evolved considerably
    since then, it would be interesting to see a book that covers the
    evolution of C++ over the last 15 years. I don't know if Stroustrup
    would be the person to write such a book or if it is better suited to
    a group of authors, considering the effect of Boost on the standard.
    --
    "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
    <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

    Legalize Adulthood! <http://legalizeadulthood.wordpress.com>
     
    Richard, Oct 11, 2010
    #18
  19. Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Sun, 10 Oct 2010 09:03:09 +0000, Juha Nieminen wrote:

    > In comp.lang.c++ ClassCastException <> wrote:
    >> What, only five replies? What, nobody's even SUGGESTED operator
    >> overloading in Java yet?

    >
    > I think the question was about *syntax*, not features. In other words,
    > which of the *existing* features of the language would you prefer being
    > able to write using a different syntax.


    Closures and semi-anonymous lambdas are an existing feature of Java, if
    you abuse some syntactic salt, such as anonymous inner classes:

    public interface IntInt {
    int foo (int x);
    }

    /**
    * Returns an IntInt that computes the same function as f, but adds amt
    * to the output; e.g. if f returns its input return adds amt to its input
    * and if f doubles its input return doubles and adds amt.
    */
    public class FooExample {
    public IntInt addUp (final IntInt f, final int amt) {
    return new IntInt () {
    public int foo (int x) {
    return f.foo(x) + amt;
    }
    }
    }
    }

    (WARNING: untested code)

    Functional programming idioms can be used in Java but presently are
    extremely ugly. Compare Scheme-style:

    (defun add-up (f amt) (
    (lambda (x) (+ amt (f x)))))

    Two lines of code, no interface or types, no syntactic salt. Less compile
    time type safety though, and you might not care for prefix instead of
    infix arithmetic. :)

    It's even possible to get a Smalltalkesque return-from-calling-method
    capability by abusing RuntimeException, and a Smalltalkesque ability to
    do other nonfunctional idioms within closures by passing in and out one-
    element arrays or other mutable boxes instead of values.

    As for macros, C and C++ have an existing, weak and unsafe macro
    facility. Gensyms would go a long way toward addressing the latter. C++
    templates provide more of the power of Lisp macros, especially combined
    with C++ macros in some cases, but still, clunkier and less safe.

    Superior syntax around certain use-cases of templates, and the addition
    of a syntax for an anonymous local functor (an implicit local class
    declaration and instantiation, implementing the () operator and able to
    use variables in the lexically enclosing scope) would go a long way in C+
    +.
     
    ClassCastException, Oct 12, 2010
    #19
  20. Alexander

    Jorgen Grahn Guest

    Re: If you could change the C or C++ or Java syntax, what would youlike different?

    On Mon, 2010-10-11, Richard wrote:
    > [Please do not mail me a copy of your followup]
    >
    > Jorgen Grahn <> spake the secret code
    > <> thusly:
    >
    >>Read the book. He describes his (and others') way of reasoning and the
    >>massive field experience he collected in order to make a decision.

    >
    > Given that this was published in 1994 and C++ has evolved considerably
    > since then,


    From my point of view it hasn't really -- the situation in 1994 seemed
    to be pretty much what was standardized in 1998. And the exciting
    parts of the book were IMHO about what happened earlier, in the 1980s
    when it wasn't clear in which direction the language would be going.

    > it would be interesting to see a book that covers the
    > evolution of C++ over the last 15 years. I don't know if Stroustrup
    > would be the person to write such a book or if it is better suited to
    > a group of authors, considering the effect of Boost on the standard.


    A chronicle of the C++ "community" since 1994 would be interesting to
    read. But probably difficult to write ...

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, Oct 12, 2010
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    0
    Views:
    424
  2. Jaga
    Replies:
    0
    Views:
    391
  3. Hassan Bobo

    I would like to change my job

    Hassan Bobo, Sep 5, 2008, in forum: C++
    Replies:
    3
    Views:
    338
    Hassan Bobo
    Sep 8, 2008
  4. Alexander
    Replies:
    620
    Views:
    8,733
    Seebs
    Nov 9, 2010
  5. Alexander
    Replies:
    60
    Views:
    1,524
    Thomas G. Marshall
    Nov 4, 2010
Loading...

Share This Page