It is currently Sat Dec 05, 2020 7:00 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: [Done] Remove the confusion with "Extends"
PostPosted: Sun Sep 20, 2020 8:32 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2741
Location: Germany
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.

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Remove the confusion with "Extends"
PostPosted: Sun Sep 20, 2020 11:54 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 429
Location: Germany
@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.

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Remove the confusion with "Extends"
PostPosted: Wed Sep 30, 2020 5:55 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1642
Location: Somewhere in the midwest
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.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] Remove the confusion with "Extends"
PostPosted: Sat Oct 03, 2020 10:26 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 429
Location: Germany
@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).

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye