Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #85518
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Function overloading |
| Date | 2022-07-21 05:45 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <tbap69$qon$1@gioia.aioe.org> (permalink) |
| References | <tb9ssj$s32$1@gioia.aioe.org> |
Cholo Lennon <chololennon@hotmail.com> wrote: > I am learning Rust. One missing C++/Java feature is function > overloading. One of the explanations of this decision is that "function > overloading is an anti-pattern", because, among other things, "it leads > to less readable and understandable code". Any language feature can be misused and "lead to less readable and understandable code". Heck, *function names* can be very easily used to write incomprehensible code (and believe me I have experience on that, having had to read a boatload of code made by other people... code that uses *extremely* poor function and variable name choices. That alone makes a lot of code ten times harder to understand than it would have to.) I assume that Rust doesn't have support for generic code, then? Because function overloading is what makes generic code work. I suppose generic code could still be written without function overloading, but it would be extraordinarily limited. Heck, the arithmetic and comparison operators supported by the vast majority of languages are "overloaded functions" of sort (and are part of what makes generic code work). I assume Rust has different arithmetic types, and operators like + and - work on all of them, and you don't have to specify different function names for different types in order to eg. add them or subtract them. User-defined overloaded functions aren't much different from overloaded operators. It's a bit artificial to deliberately limit the overloading of functions when the language already has overloading of operators built in. How do you print things in Rust, if it doesn't support function overloading? Or does it make an exception for itself, for its own elementary functions?
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Function overloading Cholo Lennon <chololennon@hotmail.com> - 2022-07-20 18:42 -0300
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-20 19:22 -0500
Re: Function overloading Gawr Gura <gawrgura@mail.hololive.com> - 2022-07-20 22:44 -0700
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-21 16:17 -0500
Re: Function overloading Cholo Lennon <chololennon@hotmail.com> - 2022-07-22 19:43 -0300
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-22 18:38 -0500
Re: Function overloading Cholo Lennon <chololennon@hotmail.com> - 2022-07-24 01:24 -0300
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-25 16:01 -0500
Re: Function overloading "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-07-26 00:05 +0200
Re: Function overloading Cholo Lennon <chololennon@hotmail.com> - 2022-07-30 18:04 -0300
Re: Function overloading Cholo Lennon <chololennon@hotmail.com> - 2022-07-30 18:03 -0300
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-08-02 23:11 -0500
Re: Function overloading Bonita Montero <Bonita.Montero@gmail.com> - 2022-07-27 16:10 +0200
Re: Function overloading Bonita Montero <Bonita.Montero@gmail.com> - 2022-07-27 16:11 +0200
Re: Function overloading Bonita Montero <Bonita.Montero@gmail.com> - 2022-07-27 16:35 +0200
Re: Function overloading Bonita Montero <Bonita.Montero@gmail.com> - 2022-07-28 05:51 +0200
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-27 14:54 -0500
Re: Function overloading Bonita Montero <Bonita.Montero@gmail.com> - 2022-07-28 05:43 +0200
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-28 13:32 -0500
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-27 15:01 -0500
Re: Function overloading Juha Nieminen <nospam@thanks.invalid> - 2022-07-21 05:45 +0000
Re: Function overloading Paavo Helde <eesnimi@osa.pri.ee> - 2022-07-21 09:04 +0300
Re: Function overloading Juha Nieminen <nospam@thanks.invalid> - 2022-07-21 07:16 +0000
Re: Function overloading Lynn McGuire <lynnmcguire5@gmail.com> - 2022-07-21 16:22 -0500
csiph-web