Craig,
In the OPI (Oz Programming Interface in Emacs) you declare all
variables on the left hand side of the expressions simply by putting
"declare" before everything. It can be a bit strange for a newbe,
certainly if you did not read CTM from the beginning. I got
frustrated by this too when I learned Oz. You better read from the
beginning, even if there is a lot you feel you could skip if you are
an experienced programmer, because you already know.
declare
class Counter % variable Counter implicitly declared
attr val
meth browse
{Browse @val}
end
meth inc(Value)
val := @val + Value
end
meth init(Value)
val := Value
end
end
C = {New Counter init(0)} % variable C implicitly declared
{C browse}
{C inc(1)}
local X % variable X explicitly declared with local scope until
matching 'end'
in
thread
{C inc(X)}
end
X=5
end
Op 3-mrt-07, om 15:00 heeft Craig Ugoretz het volgende geschreven:
Hello,
In an earlier posting, I speculated if I could "breeze
through" learning the language in order to write an Eclipse plugin
to implement an editor, debugger, etc. Well, I can see now that
learning Mozart/Oz, while not impossible, is "not a breeze". I am
essentially surveying the CTM book at this point, skipping through
the material to pick up what I can as a "first pass". Now I am
looking at Chapter 7, concerning classes. Here is a basic
question: how do I feed the following without an error message?
declare C in
class Counter
attr val
meth browse
{Browse @val}
end
meth inc(Value)
val := @val + Value
end
meth init(Value)
val := Value
end
end
C = {New Counter init(0)}
{C browse}
{C inc(1)}
local X in thread {C inc(X)} end X=5 end
A variation is to put the class definition in the part of the local
statement before the "in".
Craig
P.S.
Additionally, the following is an email that I got by posting to an
Eclipse user's group about incorporating a programming language
into Eclipse. I thought it may be interesting to share:
Here's more info on what SWT is: http://www.eclipse.org/swt/
If you are serious about developing an Eclipse plugin for any
programming language, you might want to start by talking to the CDE
people, who developed the C language eclipse plugin.
Implementing a programming language plugin is a huge undertaking,
and you need to think about many issues: editing with syntax
highlighting, compiling, debugging, etc.
You will have to get to know most of the components in the base of
eclipse, and you may discover that you need new functionality in
eclipse itself, which you may have to provide patches for and
present your case for including them in the base.
Your plugin itself will have to be written in Java - that is the
language for writing eclipse plugins, and that is the language for
programming in SWT.
The CDE newsgroup is: news://news.eclipse.org/eclipse.tools.cdt
You need to create a password to use it - this is to discourage
spammers.
Try posting there to ask what is involved, and where to start.
Good luck, and hope this helps.
Carolyn
______________________________________________________________________
___________
mozart-users mailing list mozart-
[EMAIL PROTECTED]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
---------------------
Fred Spiessens
IT Research & Consultancy
Evoluware
http://www.evoluware.eu/
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users