These are chat archives for mozart/mozart2

12th
Apr 2017
Diva Martínez
@zombiefungus
Apr 12 2017 21:33
Hi everyone, I am trying to export a class in a functor without success, could someone guide me? Class declaration and ussage work fine, but putting round a functor export MyClass define declare class MyClass <body> end end fails
error: parse error message: expected '!'
not sure about the use of declare there, but if i let it just like define class MyClass it fails with error: expansion error message:illegal use of nesting marker
Diva Martínez
@zombiefungus
Apr 12 2017 21:39
I am indeed using $ in my code but MyClass body is not changed between declaring it and wrapping it... can someone point out my mistake?
Chris Double
@doublec
Apr 12 2017 22:56
You don't need "define" inside the functor IIRC.
Oh wait, I'm thinking of declare.
Chris Double
@doublec
Apr 12 2017 23:03
Oh right, if you are using the OPI, you need to assign the functor to something:
declare
Y= functor
export
   MyClass
define
   class MyClass
      meth doit
         {Browse 1}
      end
   end
end
If it's in a file, you can just have functor ... end and ozc -c to compile it.
Diva Martínez
@zombiefungus
Apr 12 2017 23:31
sorry, what is OPI? :s
(total noob, sry)
Chris Double
@doublec
Apr 12 2017 23:56
It's the emacs environment for Mozart/Oz
So if you are using the interactive development you need to use 'declare' and assign the functor to a variable
But if you have the code inside an oz file and compile it with the command line tools you don't, since that result of the compilation is the compiled functor.