Hi,
here I will post from now on just Language related issues :
E0: internal Error reference not set to an instance of an object (in require section)
E0: internal error: Unknown typeID for System.NamedTuples
C-like memory allocation within a record (still) doesnt work, but when the type is class, it works!
Exception with a message in constructor, doesnt show in the Exception-GUI
–Shpend
ck
(Carlo Kok)
March 3, 2018, 6:03pm
2
I’m going to need that shows these issues to be able to fix them. (Except for the last one).
Thanks, logged as bugs://79714 (Message)
the 3 you know what I mean its in the project with the array, do you still have it?
the 2 you can easily reproduce, just do in the same project I sent you:
TCar = tuple of(price: int, color: byte, name:string);
btw:
would those named-tuples also be valuetyped ? thats important
just in case I am not specific enough:
ck
(Carlo Kok)
March 6, 2018, 11:27am
7
shpend_hoti:
1 E0: internal Error reference not set to an instance of an object (in require section)
2 E0: internal error: Unknown typeID for System.NamedTuples
3 C-like memory allocation within a record (still) doesnt work, but when the type is class, it works!
(2) is fixed;
I need a testcase for 1
can you separate (3) from your project so I can see this in a simple file? I’ve never been able to reproduce it.
ck:
(2) is fixed;
Cool thing, thank you!
TArray.pas (6.7 KB)
I hope it is sufficient, because the error occurs in the constructor of the module, and actually, you just need to replace the “class ” keyword with “record ” keyword
ck:
I need a testcase for 1
Ok, I testet it again in both projects(1 is just testing-stuff, 1 is handmadehero) and both compile fine with requires nearly everywhere I really could swear at some point in the code I got this E0, ok, nevermind, this is fine for now!
ck
(Carlo Kok)
Split this topic
March 7, 2018, 9:58am
9
mh
(marc hoffman)
March 6, 2018, 10:55pm
10
PLEASE stop recycling old threads for new bugs. Not sure how many more times i need to ask for this :(.
But the thread is called: “Language-related” and it is language related?
So you wish for each new bug, nevermind if he can be grouped, a new thread?
mh
(marc hoffman)
March 6, 2018, 11:54pm
12
What’s the alternative? 2023, and we’re still posting new language issues for Oxygene 15 in bis thread, because they are “language related”?
ck
(Carlo Kok)
March 7, 2018, 9:44am
13
@shpend_hoti I will miss stuff if you reuse threads. It’s also completely unclear what discussion belongs with what issue this way, and any bug report tracker reply won’t include which part of the thread it belongs to.
ck
(Carlo Kok)
March 7, 2018, 9:53am
14
TArray.pas doesn’t compile on it’s own. Can you strip it of the things not needed?
bugs://79714 got closed with status fixed.
Ok, I will relate to that, thought just to save web-space, for bugs, which could be grouped, but ok, will regard this.
Ahh, yes, I forgot to attach “GLOBALS.pas”
here the both, this is the only dependency for TArray
TArray.zip (2.1 KB)
ck
(Carlo Kok)
March 7, 2018, 11:12am
17
And make TArray<T> a record and then just new TArray(15) or something?
Tried that, seems fine. Also stripped it down (after being unable to reproduce the original issue) a lot:
namespace ConsoleApplication635;
interface
uses rtl;
type
Program = class
public
class method Main(args: array of String): Int32;
begin
var lArray := new TArray<Byte>(15);
writeLn('Ptr:'+IntPtr(lArray.first).ToString);
end;
end;
type
[Packed]
TItemState<T> = private record //use packed for array items, is more efficient
SwapedAt: IntPtr;
DeletedAt: IntPtr;
Origin: tuple of(IntPtr, T);
end;
[Packed]
TBlock<T> = public record
Value: T;
State: TItemState<T>;
end;
TArray<T> = public record
private
VOID := &default(T); readonly;
fCount: IntPtr := 0;
f_currentCapacity: IntPtr := 10;
f_first: ^TBlock<T>;
method SetToDefault(const statePtr: ^TItemState<T>);
public
constructor(const cnt: IntPtr);
property first: ^TBlock<T> read f_first;
public invariants
f_first <> nil;
fCount <= f_currentCapacity;
end;
implementation
method TArray<T>.SetToDefault(const statePtr: ^TItemState<T>);
begin
statePtr^.DeletedAt := -1;
statePtr^.SwapedAt := -1;
statePtr^.Origin := (-1, VOID);
end;
constructor TArray<T>(const cnt: IntPtr);
require
cnt > 0;
begin
f_first := ^TBlock<T>(malloc(sizeOf(TBlock<T>) * cnt));
SetToDefault(@f_first^.State);
f_currentCapacity := cnt;
end;
end.
So you get a valid f_first pointer, when TArray is record?
What value do you get from f_first ? where does it point to`?
ck
(Carlo Kok)
March 7, 2018, 1:05pm
19
Yes. As you can see I even write it out. Seems like a valid pointer.
Wow, yes now I can see it, it works pretty fine, and you know what, this was I think the whole time a Debugger-Issue
Because, when you step into the code, you should see: f_first{0} as I do !
Happens…