function parameters: is it possible to pass byref ... while being optional at the same time ?

Ali Çehreli acehreli at yahoo.com
Sun Jul 18 04:31:05 UTC 2021


On 7/17/21 8:52 PM, someone wrote:

 > I am a self-taught programmer

Same here.

 > well before college

Not here because I had access to a Sinclair Spectrum only in 1985. :/

 > I have a degree in electronics engineering

Same here.

 > one of the things that I felt in love with when I was first exposed 
to was OOP; with all its pros and cons

I learned it with C++. Then I realized that it wasn't much used in D. 
The following two presentations made me leave it completely behind 
unless a simple class hierarchy is really necessary.

1) Our friend Luís Marques presented the following at one of our local 
meetups. (He was distant. :) )

   http://files.meetup.com/18234529/luis_marques_anemic_domain_models.pdf

That presentation concludes that anemic domain models are better than 
rich design models.

An interesting question from the presentation to all OOP people is "How 
might you design a program that lets people play Monopoly with each 
other over the internet?"

Very eye opening!

2) Our "open methods" friend Jean-Louis Leroy concludes that OOP took a 
wrong path in programming language history:

   https://dconf.org/2018/talks/leroy.html

It starts with the "expression problem" (which is *not* about 
"expressions").

 > it was on one of my first jobs as a developer at a financial 
institution which by the time back in the early 90s was
 > using a database manager called FoxPro

Same here! :) I learned and programmed in FoxPro for my first job in the 
US, in Sausalito, CA in 1994. I was maintaining and improving an order 
entry, invoicing, inventory, etc. system.

I had not even heard about OOP back then to know whether FoxPro was good 
at it. :)

 > It was with this tool that I learned primarily to encapsulate everything
 > -and it payed off; code quality using OOP was far superior.

Ah! OOP carries many meanings with it. Yes, encapsulation is important, 
which I take less advantage of as I gain experience. :) (I am going 
backward!) But I left "everything is an object" mantra way back in my 
programming history. Pffft!

 > C++ came afterward with all its complexity and 50% of the guys loving
 > it

I've been one of those.

 > I respect it, it is powerful, the
 > problem with C++ is that anyone writing code with it feels the need to
 > show you how big has his ...

That.

I've been there myself and I am pretty sure most of the brain power that 
is attracted to C++ is there for the same reason. I asked a C++ speaker 
why he was interested in C++ instead of one of the more modern languages 
and he said "because it is hard".

 > unless you have some guidelines cast in stone at company level

More than 400 rules in Core Guidelines alone... Add to that more 
hundreds of MISRA, AUTOSAR, etc. standards. How can one expect 
programmers to observe all of those rules? And only some of the 
guidelines are machine-checkable.

Anyway... Back to D... :)

Ali




More information about the Digitalmars-d-learn mailing list