Oxidizer does not convert "hello world" from csharp to swift


(noman) #1

Here I have pasted the console output for the code below this. Just learning swift and I can’t find any sample programs on your site to compare. I see a main method here; why does elements say there is not? The origilnal csharp code worked fine, of course.

elements hello.swift
RemObjects Elements (Oxygene, C# and Swift) Compiler for .NET, Cocoa, Java and Island.
Version (master) built on talax, 20161118-142909. Commit b057867.
Copyright 2003-2016 RemObjects Software, LLC. All rights reserved.
Source file: D:\p\Documents\My_Swift\hello.swift
Entering phase “Loading Source Files” (00:00:00.0966922)
Entering phase “Loading Resources” (00:00:00.1158938)
Entering phase “Resolving Namespaces” (00:00:00.0022138)
Entering phase “Resolving Types” (00:00:00.0093557)
Entering phase “Resolving Properties and Events” (00:00:00.1319172)
Entering phase “Resolving Interfaces” (00:00:00.0084211)
Entering phase “Resolving Bodies” (00:00:00.0543282)
(0:0) [E103] Could not find a “Main” method in this project
Entering phase “Checking Members” (00:00:00.2147066)
Entering phase “Generating Helper Types” (00:00:00.0220813)
Compilation failed

/* Silver oxidizer translated csharp code*/

class Program {
private static func Main(_ args: String![]) {
Console.WriteLine(“What a great book!”)
// Why does the elements compiler say there is no main method

(marc hoffman) #2

because Main methods work differently in Swift, but Oxizider just blindly translates syntax, not semantics.

Just drop the surrounding class and method and just put Console.WriteLine("What a great book!") into the top scope of the file/.