Enum as String


(Friedrich Westermann) #1

How can I get a Enum Value as String in
Island and Toffee using Rtl2

Sample:

type myenum = enum(first, second);

in Echoes it is simply myenum.ToString;

in Toffee and Island I get the underlying int (0,1)…::


(marc hoffman) #2

Hm, even in Island? For Toffee this is a known issue, but I was just going to say that moving to Toffee V2 is going to fix this because in Island that’s supposed to work fine. What Island platform did you check, and can you send me a tetscase?

thanx!


(Friedrich Westermann) #3

It does not work for Island,
look in the Solution, the Net one works,
The Darwin one not even starts, and the Island windows prints integers for enums
TestSolutions.zip (36.2 KB)


(RemObjects) #4

Thanks, logged as bugs://81910


(RemObjects) #5

bugs://81910 got closed with status fixed.


(Friedrich Westermann) #6

Sorry to be a pain in the a…
but with latest 2371 (Fire). the Island Windows will not compile, and the Darwin will not run… same project


(marc hoffman) #7

care to be more specific?


(marc hoffman) #8

Darwin runs fine for me:

~> Process DarwinConsoleApplication377 started
The magic happens here.
~> Process DarwinConsoleApplication377 terminated with exit code -1

bunt can confirm that Island/Windows fails to link

E:                Invalid record

is that the same error you get there?


(Friedrich Westermann) #9

Yes for Windows it is this exception.
Darwin will crash in the Debugger.
The problems is the String.Class;

Simple Test:

namespace ConsoleApplication2;

type
  Program = class
  public
    class method Main(args: array of String): Int32;
    begin
      // add your own code here
      writeLn('The magic happens here.');
      writeLn('Test'.ToLower);
    end;
  end;
end.
~> Process ConsoleApplication2 started
The magic happens here.
!> Fatal exception of type RemObjects.Elements.System.Exception on thread 2CAA
!> Message: RemObjects.Elements.System.Exception:
Uncaught exception: RemObjects.Elements.System.NullReferenceException: Member access on null reference; for expression: self
~> Process ConsoleApplication2 terminated with exit code -1

(marc hoffman) #10

See that’s why a testcase matters ;).

I’ll log; wondering if this is related/same issue as “81913: ToffeeV2: problem passing string literal to Cocoa API” which I logged yesterday…


(RemObjects) #11

Thanks, logged as bugs://81927


(marc hoffman) #12

Oh, and “81926: Island/Windows fails to link in 2371.” was also logged yesterday.


(marc hoffman) #13

Turns out, ToLocal never worked, so this isn’t a regression in 2371, s your message implied? We’re working n a fix, of course, it just never was fully implemented on Darwin yet…


(RemObjects) #14

bugs://81927 got closed with status fixed.