PureBasic Forum
http://forums.purebasic.com/english/

[Done] Remove the confusion with "Extends"
http://forums.purebasic.com/english/viewtopic.php?f=3&t=75966
Page 2 of 2

Author:  mk-soft [ Sun Sep 20, 2020 8:32 pm ]
Post subject:  Re: [Done] Remove the confusion with "Extends"

Now you have taken a completely wrong turn.
In my opinion the Purebasic help is clear, how it is handled with "Extends".
Quote:
The optional Extends parameter allows to extends another structure with new fields. All fields found in the extended structure will be available in the new structure and will be placed before the new fields. This is useful to do basic inheritance of structures.


Even the translation with DeepL into German is clear.
Quote:
Der optionale Extends-Parameter erlaubt es, eine andere Struktur um neue Felder zu erweitern. Alle Felder, die in der erweiterten Struktur gefunden werden, sind in der neuen Struktur verfügbar und werden vor den neuen Feldern platziert. Dies ist nützlich, um grundlegende Vererbung von Strukturen durchzuführen.


The new structure is extended with the fields of the structure given with Expends. And these will be added at the beginning of the new structure. The given extended structure will not be changed.

Author:  Sicro [ Sun Sep 20, 2020 11:54 pm ]
Post subject:  Re: [Done] Remove the confusion with "Extends"

@mk-soft:
Thanks, but to make it clear: I know how the keyword Extends works.

I have nothing against the explanations in the PB help. Of course, a programmer should have a look into the PB help if the function of a command is unclear, but the first thing you see is the command name in the code and this command name should be understandable enough on its own at best.

The ambiguity of the keyword just came to my mind while I was working on my codes that use the keyword Extends in some structures and I wanted to mention the ambiguity of the keyword here in case someone had the same thought once. I was simply interested in what others thought about it.

Everybody thinks the keyword is good, I am satisfied with it and everything is ok. As you can see the topic is already marked as done since several hours.

Author:  Zach [ Wed Sep 30, 2020 5:55 pm ]
Post subject:  Re: [Done] Remove the confusion with "Extends"

Just wanted to comment since I saw this frame of reference brought up.
As a native english speaker, I have never found the Extends keyword to be vague in any way.


The "it could also be read to work this way" example has never so much as crossed my mind. Maybe its just a difference in grammar rules that is causing the confusion.

Author:  Sicro [ Sat Oct 03, 2020 10:26 am ]
Post subject:  Re: [Done] Remove the confusion with "Extends"

@Zach:
Thanks.

The thought came to my mind after I saw a code that looked something like this:
Code:
abstract class Class1 {...}

class Class2 extends Class1
{
  private Class1 value1 ;
  private Class1 value2 ;

  public Class2 (Class1 value1, Class1 value2) {
    this.value1 = value1 ;
    this.value2 = value2 ;
  }
}

class Class3 extends Class1
{
  private Class1 value1 ;
  private Class1 value2 ;

  public Class3 (Class1 value1, Class1 value2) {
    this.value1 = value1 ;
    this.value2 = value2 ;
  }
}
A class is of course something different than a structure, but as I interpret the code it can also be used to structure data.

But here in the thread some good points were already mentioned, which exclude a wrong interpretation of the keyword Extends as long as you remember these points (e.g. PureBasic is a single-pass compiler).

Page 2 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/