Enum as String

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)…::

1 Like

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!

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)

Thanks, logged as bugs://81910

bugs://81910 got closed with status fixed.

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

care to be more specific?

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?

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

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…

1 Like

Thanks, logged as bugs://81927

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

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…

bugs://81927 got closed with status fixed.