implicit return? [🇷 for BE/BA]

posted by d_labes  – Berlin, Germany, 2019-04-28 21:36 (1616 d 20:19 ago) – Posting: # 20255
Views: 6,011

Hi Öberster Größter Meister,

❝ "smart" lost this round.


Totally.

❝ I always use explicit return(something) in my functions, when they are supposed to return a value regardless of whether it is a list, numeric, NULL or data frame some other thingy.


A good idea. But if you use R you are told that doing so has the penalty of a longer run-time.
Bloody Hell!

❝ Yes, that involves tapping a few times more on the keyboard but it does solve a lot of problems and best of all, it makes code readable.


Full ACK!

❝ In language like C you would never run into this phenomenon. You declare explicitly which type the function returns and you will be bombarded with errors or warnings if you fail to return the right type of if you forget the return statement. I find it very comfortable.


Weakly typed (R) against strong typed language (C or C++).
But IIRC has C or C++ also some weaknesses.

Regards,

Detlew

Complete thread:

UA Flag
Activity
 Admin contact
22,763 posts in 4,775 threads, 1,628 registered users;
12 visitors (0 registered, 12 guests [including 2 identified bots]).
Forum time: 17:55 CEST (Europe/Vienna)

Restlessness is discontent –
and discontent is the first necessity of progress.
Show me a thoroughly satisfied man 
and I will show you a failure.    Thomas Alva Edison

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5