Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Overloading

Name: Anonymous 2011-03-01 20:42

Exhibit A


void some_function(int a = some_default_value)
{
    do_something(a);
}



Exhibit B


void some_function()
{
    do_something(some_default_value);
}

void some_function(int a)
{
    do_something(a);
}


Which do you prefer? (e.g. C# forces the 2nd example)

Name: Anonymous 2011-03-01 20:53

StackOverflow-quality post right here.

Name: Anonymous 2011-03-01 20:58

Obviously default values are more convenient if you are using it for default values. And obviously, overloading allows you to, well, overload on different types, which default values won't in a statically typed language.
I'd prefer a language to support both, though the features do not interact very well. Still, it wouldn't be a problem to let each function use either default values or overloading.

Name: Anonymous 2011-03-01 22:02

ONE WORD THE FORCED OVERLOADING OF FUNCTIONS THAT MIGHT HAVE DEFAULT VALUES THREAD OVER

Name: Anonymous 2011-03-01 22:05

You can do both in C# 4

Name: Anonymous 2011-03-01 22:16

>>2
fuck you faggot

Name: Anonymous 2011-03-02 1:24

>>1
I prefer

fun a=defval -> a.do_something

Name: Anonymous 2011-03-02 1:32

>>1
I prefer (define (fun (a default)) (do-something a))

Name: Anonymous 2011-03-02 1:52

I prefer Penis

Name: Anonymous 2011-03-02 2:01

I prefer Suntory times.

Name: Anonymous 2011-03-02 2:07

Exhibit A Is obviously superior, because it eliminates duplication of code.

Concision is paramount. Concision and speed. Nothing else matters.

Name: Anonymous 2011-03-02 2:09

ONE WORD: THE FORCED DUPLICATION OF CODE. THREAD OVER

Name: Anonymous 2011-03-02 2:42

>>1
S͔̥̠͉̲̺̖̖͢͜ͅe҉̸͍͙̤͎͖͎̼̟̗̯̩̫̣̩̘̭̙͙̭g͏̴̷̛̭̞̩̖̫͉̮̬̤͔ͅḿ̶̡̻͈̫͎̻̜̭̠͈̤͠ͅe̶̸̸͍͕̙͕̜̝͉͖͎̮̹̫̩͚͇̪̱͞n͘҉̢͎̬̥̫̲̮̗͙̮̥͎̣͚͈̞t̴̶̢̩̼͇̖͍͎̞͚̮͙̖̗̤̯̣̣̰̰̀́a̴̩̮̱͉̤̝̼͈͚̜̬̥̫̩̻̬͟ͅt̨̜͈̯̝̱͕͕͓͍̠̱̼̣͎̘̺̭͞i̸̧̢̯̜̯̝͙͕͕̬̹̥̻͔̗͢͠o̢̱̝̪͕͜͡n̵͓̞̠̮̰̳̩͕͘͟͢ ̛̞̰̬͓̥̥́͢ͅF҉̶̸̡̜̳̣͍͓͈̖̱͖̗̕à̢͈̲͙̙̳̱̹ù̡̫͓̺͓̕ĺ̨̯̮̭̖̹̠̱̠̭̬̺̳͍̼̬̺̤̲̯͟͞͡t̢̙̗͈̝̼̠͓̺͖̦͎͚̟̳̹̥̬́̕͡

Name: Anonymous 2011-03-02 5:58

(a default)
verbosis

Don't change these.
Name: Email:
Entire Thread Thread List