▲ 8 ▼ Wren: A classy little scripting language (wren.io) submitted 1 year ago by rssbot@lemmy.bestiver.se [B] to c/hackernews@lemmy.bestiver.se 9 comments fedilink hide all child comments Comments
[–] Cochise@lemmy.eco.br 1 point 1 year ago (2 children) This is common on OOP. https://en.wikipedia.org/wiki/Function_overloading permalink fedilink source parent hideshow 2 child comments replies: [–] whiwake@sh.itjust.works 1 point 1 year ago (1 child) Yes. Which frequently leads to complications. #include <iostream> using namespace std; void log(int level) { cout << "Logging numeric level: " << level << endl; } void log(string message) { cout << "Logging message: " << message << endl; } int main() { log('A'); // Uh oh — which one is this? } permalink fedilink source parent hideshow 1 child comment replies: [–] ChairmanMeow@programming.dev 3 points 1 year ago The level one. But that's more due to implicit casting rather than function overloading imo. permalink fedilink source parent
[–] whiwake@sh.itjust.works 1 point 1 year ago (1 child) Yes. Which frequently leads to complications. #include <iostream> using namespace std; void log(int level) { cout << "Logging numeric level: " << level << endl; } void log(string message) { cout << "Logging message: " << message << endl; } int main() { log('A'); // Uh oh — which one is this? } permalink fedilink source parent hideshow 1 child comment replies: [–] ChairmanMeow@programming.dev 3 points 1 year ago The level one. But that's more due to implicit casting rather than function overloading imo. permalink fedilink source parent
[–] ChairmanMeow@programming.dev 3 points 1 year ago The level one. But that's more due to implicit casting rather than function overloading imo. permalink fedilink source parent