Recent

Author Topic: type's already defined in system.pas  (Read 3519 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 16135
  • Censorship about opinions does not belong here.
Re: type's already defined in system.pas
« Reply #15 on: February 21, 2024, 10:08:05 pm »
You have to show me line 472 with all information.
If I smell bad code it usually is bad code and that includes my own code.

paule32

  • Sr. Member
  • ****
  • Posts: 280
Re: type's already defined in system.pas
« Reply #16 on: February 21, 2024, 10:29:17 pm »
I have already post it:
https://dpaste.com/44S4GWESK#line-472

Code: Pascal  [Select][+][-]
  1. ...
  2. constructor QString.Create;
  3. begin
  4.     FStringObject := nil;
  5.     FStringObject.FString := '';
  6. end;
  7. ...
  8.  

I would create a custom system.pas, but I can not create base TObject class.

bytebites

  • Hero Member
  • *****
  • Posts: 680
Re: type's already defined in system.pas
« Reply #17 on: February 21, 2024, 10:53:55 pm »
What is purpose of FStringObject?

paule32

  • Sr. Member
  • ****
  • Posts: 280
Re: type's already defined in system.pas
« Reply #18 on: February 21, 2024, 10:57:36 pm »
nothing at all currently.
I expected, that fpc create a system unit - independed what Variables I use.

bytebites

  • Hero Member
  • *****
  • Posts: 680
Re: type's already defined in system.pas
« Reply #19 on: February 21, 2024, 11:10:39 pm »
Internal error 200305108 may tell that newinstance method is missing.

if
Code: Pascal  [Select][+][-]
  1. FStringObject := nil
then 
Code: Pascal  [Select][+][-]
  1. FStringObject.FString := '';
will fail.

TRon

  • Hero Member
  • *****
  • Posts: 3618
Re: type's already defined in system.pas
« Reply #20 on: February 21, 2024, 11:29:45 pm »
Internal error 200305108 may tell that newinstance method is missing.

To put it more bluntly:
Code: Pascal  [Select][+][-]
  1. nil.FString := '';
  2.  

Where do you think that one is pointing to in memory paule32 ?

But then you would need to create QObject in order to create an actual instance of QObject, which in turn will need to create a new QObject instance, which needs to create an instance of QObject ad infinitum
This tagline is powered by AI

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1198
Re: type's already defined in system.pas
« Reply #21 on: February 22, 2024, 12:28:14 am »
In other words it looks like he is trying to use a non existent variable.

I just noticed that when I type nil. Into Lazarus it gives me a popup menu of names that are text. I find it strange that nil. Gives an autocomplete there is no way that anything after Nil would be valid is there?
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: type's already defined in system.pas
« Reply #22 on: February 22, 2024, 01:27:22 am »
I just noticed that when I type nil. Into Lazarus it gives me a popup menu of names that are text. I find it strange that nil. Gives an autocomplete there is no way that anything after Nil would be valid is there?
Curious. It does not for me. Just about anything else does. An invalid identifier, ie, a mis-spelling always gives a menu of text, with the type greyed out. I have always wondered why ?  But, for me, Lazarus 3.0, "nil." does not pop up a autocomplete menu.

Strange.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

paule32

  • Sr. Member
  • ****
  • Posts: 280
Re: type's already defined in system.pas
« Reply #23 on: February 22, 2024, 08:24:26 am »
it is not an issue of nil. something.
it is an issue, that fpc does not compile custom Code.
And the makers of fpc seems to have built-in some traps, that it makes more sense, to create my own Pascal Compiler.
Because, before I waste my Time with patching fpc, I have write my own Compiler in the same Time.
I was thinking, that fpc will be great.
But when it is not possible to make a custom system.pas, then I could use Delphi CE instead fpc.
Which make more sonse as follow not Open Source licenced Software that are written, so complicated, that the use of Open Source makes no sense in the capital market.
It would be prized, that you can make commercial Software with fpc.
But for me, it is a Blender-Software, now.

Thaddy

  • Hero Member
  • *****
  • Posts: 16135
  • Censorship about opinions does not belong here.
Re: type's already defined in system.pas
« Reply #24 on: February 22, 2024, 08:39:28 am »
Delphi does the same: inserting some code that is predefined in the compiler, not in any library so that is not a good argument. You'd better take in all the good advise you have been given. Note I wrote and co-wrote several system replacements for Delphi and also for FPC. Follow the steps in the wiki and do not make assumptions before you researched if your assumptions are correct...
I already predicted you are stubborn...

free giveaway: code that is not in any library but internal to the compiler is in the system.fpd file. Not a compilable file, but essentially a description of all the compiler built-ins.
Told you so: it is difficult.

AND I wonder why you did not know about system.fpd. That means you did not research at all. Examining system.fpd can make you decide which parts of the compiler sources you want to remove. But note then it becomes very, very difficult because a lot of compiler code is intertwined.
« Last Edit: February 22, 2024, 09:12:07 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

paule32

  • Sr. Member
  • ****
  • Posts: 280
Re: type's already defined in system.pas
« Reply #25 on: February 22, 2024, 08:43:33 am »
free giveaway: code that is not in any library but internal to the compiler is in the system.fpd file. Not a compilable file, but essentially a description of all the compiler built-ins.
Told you so: it is difficult.

That is True.
But when I stuck in Voodoo Programming, because the Compiler tell me, that he can not compile the ctor of TObject:

1: constructor TObject.Create;
2: begin
3: end;

on Line 2.
Then I begin to merylin, WTF is going on there...

Thaddy

  • Hero Member
  • *****
  • Posts: 16135
  • Censorship about opinions does not belong here.
Re: type's already defined in system.pas
« Reply #26 on: February 22, 2024, 08:50:19 am »
Well, i already gave you that answer. And proper Danes can write compilers in their sleep, as I mentioned before  ;D ;)
« Last Edit: February 22, 2024, 09:00:51 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

TRon

  • Hero Member
  • *****
  • Posts: 3618
Re: type's already defined in system.pas
« Reply #27 on: February 22, 2024, 11:05:37 am »
it is not an issue of nil. something.
Not it isn't (the compiler issues an error before that) but no matter how you try, that code is not going to work.

Quote
And the makers of fpc seems to have built-in some traps, that it makes more sense, to create my own Pascal Compiler.
That is a nice conspiracy theory  :)

Quote
Because, before I waste my Time with patching fpc, I have write my own Compiler in the same Time.
I do believe (but have to guess based on what I noticed in your paste) you have a more pressing matter and that is that you do not seem to distinguish the different OOP implementations as you seem to mix old style objects with new style TObject.

Code: Pascal  [Select][+][-]
  1. destructor QString.Destroy;
  2. begin
  3. qFStringObject^.Free;
  4. end;
  5.  
Where I assume the q is just a typo but the ^.Free was actually intended ?
This tagline is powered by AI

paule32

  • Sr. Member
  • ****
  • Posts: 280
Re: type's already defined in system.pas
« Reply #28 on: February 22, 2024, 12:13:10 pm »
@Thron:
the last Part was a Typo, yes - sorry for confusion you.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1198
Re: type's already defined in system.pas
« Reply #29 on: February 22, 2024, 01:01:59 pm »
@dbannon I’m using 2.0.12  version of laz on win 7 so it might be that might be it. The feature that will show names of things that are out of scope As “text” definitely are helpful.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

 

TinyPortal © 2005-2018