Oberon Community Platform Forum
September 23, 2017, 08:38:35 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: "refines"?  (Read 5874 times)
hreba
Newbie
*
Posts: 14


« on: January 27, 2009, 06:26:34 PM »

What is wrong with the following program?
Code:
module Main;
definition D1;  var x: real;  end D1;
definition D2 refines D1;  var y: real;  end D2;
end Main.
I get the compiler error message
Name 'D1' does not denote a definition as expected.
What is D1, if not a definition?
Logged
hreba
Newbie
*
Posts: 14


« Reply #1 on: January 29, 2009, 10:55:21 PM »

Ok, 2 day ago I posted a simple question, 36 people read it, nobody answered. So what is it?
  • Is it the question? Is it too difficult to answer or is it so trivial that nobody cares?
  • Is it the language? Is Zonnon dead?
  • Is it the group? Where am I?
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #2 on: January 30, 2009, 03:05:29 AM »

Zonnon is interesting but I can't answer your question. Do you have another one, preferably relating to realtime raytracing? Please don't be frustrated.
Logged
masta
Newbie
*
Posts: 19


empamedia.ethz.ch


« Reply #3 on: January 30, 2009, 08:01:46 AM »

I have no idea about Zonnon syntax, but it seems to me from examples I found, that end D1 needs a . , not a ; ?
Logged
rmitin
Moderator
Newbie
*****
Posts: 22


« Reply #4 on: January 30, 2009, 10:22:17 AM »

The program is correct. It is a bug in the compiler.
This program will compile:

module Main;
definition D1; 
   var x: real; 
end D1;
definition D2 refines Main.D1; 
   var y: real; 
end D2;
end Main.

however your version is correct. It will be fixed.

UPDATE: Please download 1.1.9 compiler. It fixes the problem.
« Last Edit: January 30, 2009, 01:01:47 PM by rmitin » Logged
hreba
Newbie
*
Posts: 14


« Reply #5 on: January 30, 2009, 04:04:15 PM »

Zonnon is interesting but I can't answer your question. Do you have another one, preferably relating to realtime raytracing? Please don't be frustrated.
What do you mean by "another one": another language or another test program? I am somewhat puzzled, because my Zonnon test project is indeed a simple raytracer. How did you know that? What do you mean by realtime raytracing?
Logged
hreba
Newbie
*
Posts: 14


« Reply #6 on: January 30, 2009, 04:16:19 PM »

rmitin, thanks for your help.

In a private email you mentioned (abandoned) discussions to remove the refines statement from the language. What I need is an abstract base class, lets say D0, and some derived classes which will be implemented. So I wanted write D0 as a definition, and write other definitions D1, D2, ... as refinements together with the implementations I1, I2, ... . What would be the "official" way to do that? If there were those discussions, there must exist an alternative.
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #7 on: January 30, 2009, 08:40:43 PM »

Quote
I am somewhat puzzled, because my Zonnon test project is indeed a simple raytracer. How did you know that?

I did not know that. Tracing is my hobbyhorse.

Quote
What do you mean by realtime raytracing?

http://en.wikipedia.org/wiki/Framerate

By realtime I mean "fast enough that I can fly around the toy world interactively". Between 5 and 10 frames per second.

http://en.wikipedia.org/wiki/Framerate

http://www.youtube.com/user/xenopusRTRT
Logged
rmitin
Moderator
Newbie
*****
Posts: 22


« Reply #8 on: February 03, 2009, 07:50:41 PM »

rmitin, thanks for your help.

In a private email you mentioned (abandoned) discussions to remove the refines statement from the language. What I need is an abstract base class, lets say D0, and some derived classes which will be implemented. So I wanted write D0 as a definition, and write other definitions D1, D2, ... as refinements together with the implementations I1, I2, ... . What would be the "official" way to do that? If there were those discussions, there must exist an alternative.

What you are saying is the "official" way for doing this if you need inheritance. Without "refine" statement the programming model would be more based on composition. The question is how often you really need to refine interfaces at all. Take COM model as an example. However refine statement is in the language.
Logged
hreba
Newbie
*
Posts: 14


« Reply #9 on: February 04, 2009, 12:52:47 PM »

Without "refine" statement the programming model would be more based on composition. The question is how often you really need to refine interfaces at all. Take COM model as an example. However refine statement is in the language.

The definitions D1, D2, ... and implementations I1, I2, ... I had in mind would all be subtypes of D0. My questions are:
  • If D0 shall be an abstract base type, then the only way to do that is via a definition, correct?
  • When do you implement a definition by an implementation and when do you use an object?
  • In my example, D0 does not have an implementation, only its subtypes D1, D1,... do. When I try to compile that, I get an error message telling me that the (public) variables of D0 have no default values or are not accessible. How do I get around this?
Those questions which refer more to the programming style than to the syntax would typically be treated in a book rather than in a language report. Is there anything under way in english?
Where do I find something about the COM model?
Logged
rmitin
Moderator
Newbie
*****
Posts: 22


« Reply #10 on: February 09, 2009, 04:40:52 PM »

1. Correct. The only way to create an abstract base type is via use of definitions.
2. You use implementation for "partial implementation" when you want to extend it later. In terms of inheritance that would be a class which is still abstract but already has some functionality implemented. When you want to create an actual class from which you want to instantiate objects that would be an 'object'. In terms of OOP that would be a final or sealed class.
3. It is a 'warning' message only (at least in the latest version of the compiler and there were no messages in old compiler). In fact the compiler should not give a warning in this case. It will be fixed. Sorry for inconvenience.

Some information about COM you can find here http://www.microsoft.com/com/default.mspx
or on Wikipedia.

Yes. We plan to come up with a tutorial in English this summer.

Thank you!
Logged
hreba
Newbie
*
Posts: 14


« Reply #11 on: February 09, 2009, 05:00:31 PM »

Thanks a lot, now I see much better when to use what.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!