• (cs) in reply to loneprogrammer

    loneprogrammer:
    Manni:
    What's wrong with such a concept? If I don't supply a certain parameter, assume the value is "0", or False, etc.

    There is nothing wrong with the idea.  What makes them problematic is that default arguments are basically variable length argument lists.  Combine this with function overloading and this can happen:

    foo(int arg1);
    foo(int arg1, int arg2 = 0);
    foo(int arg1, int arg2 = 0, int arg3 = 0);

    Which one gets called for foo(42)?

    Excellent point lone. I can't say I've run into the situation like you have above, but I'd like to think that I wouldn't combine overloaded functions with optional parameters. In that case, I'd simply name the functions differently.

  • (cs) in reply to Manni

    ...and by the way, foo(42) would return "The meaning of life".

    Hey Alex, why do you bother to include the "Edit" button if we're not allowed to use it? I posted a message and then immediately (< 5 sec) tried to edit it, and I was told the time limit had expired.

  • (cs) in reply to Manni
    Manni:

    ...and by the way, foo(42) would return "The meaning of life".

    Hey Alex, why do you bother to include the "Edit" button if we're not allowed to use it? I posted a message and then immediately (< 5 sec) tried to edit it, and I was told the time limit had expired.



    The 'Edit' button was put there to demonstrate the superiority of (in)telligent systems' CommunityServer. It has no real function, except to make the people who wrote the webboard feel superior about their string of WTFs and plain errors. Also, it helps with the irony factor.
  • Zatanix (unregistered) in reply to rsynnott

    I've never heard that # should mean pound before. (does anyone still use that weight-unit? It's like using "feet" instead of meters. Or like using how high on the sky the sun is for measuring what time it is, instead of minutes/hours...)
    Here we either call it "number sign" (because it's used instead of the word "number") or "havelåge" ("garden gate" - it looks like those gates some people has in their fence around their garden)

    About the WTF: It's an extreme whattafuk that java doesn't have unsigned types! But it could've been worse - it could have had no types at all. Imagine that. No types in java.. Maybe now you can appreciate the signed types a bit more, huh? (yes, i'm drunk)

  • (cs) in reply to Manni
    Manni:

    loneprogrammer:
    Manni:
    What's wrong with such a concept? If I don't supply a certain parameter, assume the value is "0", or False, etc.

    There is nothing wrong with the idea.  What makes them problematic is that default arguments are basically variable length argument lists.  Combine this with function overloading and this can happen:

    foo(int arg1);
    foo(int arg1, int arg2 = 0);
    foo(int arg1, int arg2 = 0, int arg3 = 0);

    Which one gets called for foo(42)?

    Excellent point lone. I can't say I've run into the situation like you have above, but I'd like to think that I wouldn't combine overloaded functions with optional parameters. In that case, I'd simply name the functions differently.

    In the case of Delphi, you would get a compile error for making an ambiguous call.  It will let you combine overrides with default params, but only if you make them unambiguous.

  • (cs) in reply to Zatanix

    Anonymous:

    About the WTF: It's an extreme whattafuk that java doesn't have unsigned types! But it could've been worse - it could have had no types at all. Imagine that. No types in java.. Maybe now you can appreciate the signed types a bit more, huh? (yes, i'm drunk)

    It's actually not a problem that Java has no unsigned types (actually char is an unsigned short).  I've never missed them and it simplifies things greatly.

  • (cs) in reply to Drak
    Drak:

    There's a way to allow an arbitrary number of parameters to be used as function arguments in VB.NET.

    <font color="#0000ff" size="2"> </font>

    <font color="#0000ff" size="2">Private</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font><font size="2"> Woofer(</font><font color="#0000ff" size="2">ByVal</font><font size="2"> </font><font color="#0000ff" size="2">ParamArray</font><font size="2"> intSomeIntegers() </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2">)</font>

    <font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Sub</font>



    Sure, and you can always pass in a System.Collections.Hashtable in C-octothorpe, using the appropriate casts, blowing the type system entirely away and assuring a spot in the annals of thedailywtf...
  • ding (unregistered) in reply to smitty_one_each

    Its traditional commercial use was such that when it followed a number, it was to be read as 'pounds': 5# of sugar. And when it preceded a number, it was to be read as 'number': #2 pencil, which still appears on US pencils. Thus the same character in a printer's type case had two uses.

    It has many other names (and uses) in English. (Those in bold are listed as alternative names in the Unicode documentation.)

    • comment sign
    • crosshatch
      • resemblance
    • crunch
      • ?
    • fence, gate, grid, gridlet
      • resemblance
    • hash / hash mark / hash sign
      • the most common name outside the US, including in the UK and Australia
      • Used in the UK and Australia on touch-tone telephones – "Please press the hash key"
    • hex
      • from its use to denote hexadecimal values in some markup and programming languages
    • octothorn
      • William Sherk in 500 Years of New Words (1983), p. 272, has the following entry: "Octothorn, The number sign (#); so called because there are eight points, or thorns, sticking out of it ... ."
    • octalthorpe / octothorp / octothorpe
    • pig pen
      • resemblance
    • pound / pound sign
      • Used as the symbol for the pound avoirdupois in the U.S. (where lb. would be used in the UK and Canada; note that lb. or lbs. is common in the U.S. as well and is used by the general public more often than #). Never called "pound" in the UK, where the term denotes the pound sterling and its symbol (£).
        • Keith Gordon Irwin in, The Romance of Writing, p. 125 says: "The Italian libbra (from the old Latin word libra, 'balance') represented a weight almost exactly equal to the avoirdupois pound of England. The Italian abbreviation of lb with a line drawn across the letters was used for both weights. The business clerk's hurried way of writing the abbreviation appears to have been responsible for the # sign used for pound."
      • Used in the U.S. and Canada on touch-tone telephones – "Please press the pound key"
    • sharp
      • resemblance to the glyph used in music notation; so called in the name of Microsoft's new programming language, C#. However Microsoft says at Frequently Asked Questions About C# (http://msdn.microsoft.com/vcsharp/productinfo/faq/default.aspx):
        It's not the "hash" (or pound) symbol as most people believe. It's actually supposed to be the musical sharp symbol. However, because the sharp symbol is not present on the standard keyboard, it's easier to type the hash ("#") symbol. The name of the language is, of course, pronounced "see sharp".
        Since most fonts don't contain the sharp sign most websites will doubtless continue to use the fallback hash mark. The "music sharp sign" which should be used if available is U+266F (?).
    • splat
      • colloquial term referring to vague resemblance of # to a squashed spider; this term is also used for the asterisk (*), though.
    • square
      • often misattributed as the UK name for #, in reference to touch-tone telephones. From the earliest days of # appearing on telephones, it has been called "hash".
      • the International Telecommunications Union specification ITU-T E.161 3.2.2 states: "The # is to be known as a 'square' or the most commonly used equivalent term in other languages."
    • tic-tac-toe (US) / noughts-and-crosses (UK)
      • resemblance to game board
    • widget mark
  • (cs) in reply to Mike R
    Mike R:
    Manni:

    ...and by the way, foo(42) would return "The meaning of life".

    Hey Alex, why do you bother to include the "Edit" button if we're not allowed to use it? I posted a message and then immediately (< 5 sec) tried to edit it, and I was told the time limit had expired.



    The 'Edit' button was put there to demonstrate the superiority of (in)telligent systems' CommunityServer. It has no real function, except to make the people who wrote the webboard feel superior about their string of WTFs and plain errors. Also, it helps with the irony factor.

    If "in" is a negative prefix, as in "impossible" == "not possible", and "intelligent" == "not dumb", then I guess we all know what "telligent" must mean.

  • (cs) in reply to Manni
    Manni:

    ...and by the way, foo(42) would return "The meaning of life".

    Hey Alex, why do you bother to include the "Edit" button if we're not allowed to use it? I posted a message and then immediately (< 5 sec) tried to edit it, and I was told the time limit had expired.



    No it wouldn't!  It will return, however, the ultimate question to Life, the Universe, and Everything (the argument being the answer, of course). :)

        -dZ.

  • Shinma (unregistered) in reply to Buff

    The use of the # symbol is still used for pounds (weight, not monetary) and is always used postfix.   It is still most often seen as part of a description of a person.  For example:  6'2" 175#

  • (cs) in reply to Shinma

    Hahaha oh man, C-octothorpe...  That's my new thing.

Leave a comment on “Java Hoops And Hurdles”

Log In or post as a guest

Replying to comment #:

« Return to Article