Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: Preview cha...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1108 of 1154
Post > Topic >>

Re: Preview chapter about object orientation

by thomas.mertes@[EMAIL PROTECTED] Feb 16, 2008 at 03:23 AM

On 16 Feb., 00:57, Reinder Verlinde <rein...@[EMAIL PROTECTED]
> wrote:
> I do not mean to be harsh, but the way it is written, I do not see a
> natural audience for this chapter. The text, IMO, is aimed at beginners.
>
> Your language being a new and unknown language, beginners will only
> start learning it if you force-feed it them.

I am not in the position to force-feed anything to beginners.

> If you can not force beginners to be 'interested' in your language, your
> only bet, to me, is with people naturally interested in almost any
> programming language. For them, this text is too simple. For example, I
> think the text can assume "interface", "dynamic dispatch" to be known
> concepts.

You are right, the concepts are known, but the usage of this concepts
in Seed7 is a little bit different. For example: Structs (which are
used as implementation types) do a deep copy when assigned, dynamic
dispatch only takes place when an interface (DYNAMIC) function has
been defined...

> For them, you will also have to be clear in why one would read
> up on this niche language.

So I should mention multiple dispatch or the possibility to attach
methods to values instead of types (this subchapter is missing, it
will follow). What do you think?

> On the other hand, there is quite a bit that I would like to know that
> the site and this text do not explain about seed7 (or at least, that I
> could not easily find):
>
> 1) I do not see why it must be
>
>         const type: circle is new struct
>         const type: shape is new interface;
>
>    but
>
>         const proc: f (in type: argument) is func
>
>    What exactly is new about circle and shape, but not about f?

The circle and the shape are not derived from another struct type as
for example external_file:

  const type: external_file is sub null_file struct

BTW: Although the keyword 'new' is used, no memory allocated here.

> 2) what does that 'const' keyword (is it a keyword?) mean precisely?

Seed7 does not have keywords, but I use the term keyword since many
programmers are familiar with it. Things declared with 'const' are
not changeable. Const works deep: Struct elements and array elements
are also not changeable (I will add this description to the chapter
9.3 Semantic declarations. Do you know a better place? ).

> Are there modifiable types? modifiable type instances?

There are type variables. The compiler uses declarations like

  var type: object_type is void;

The compiler uses the reflection to assign a value to such a variable:

  object_type := getType(params[3]);

> Are types first-class objects?

You can have type constants, variables, parameters, and functions
returning a type. The type 'type' is not an interface type therefore
you cannot declare derived struct/class types of 'type'. So the type
'type' behaves like 'boolean' and not like 'file'.

In functions getting a type with a parameter you can declare objects
with this types. This is intended to be used for template/generic
programming. The types 'array' and 'struct' are just functions with
a type result. This functions do all declarations necessary for such
an 'array' or 'struct'. This will be described in my next chapter:
Abstract data types.

> 3) Is there a difference between procedures and functions? If not, why
> use two different terms? If so, what exactly does "const proc: main is
> func" define? Paragraph 2.1 on the site does not appear to know the
> answer. On the one hand, it says "Declaring 'main' with the type 'proc'
> makes a procedure out of it". On the other hand, it says "Additionally
> the seed7_05.s7i library defines the 'main' function as entry point for
> a Seed7 program".

A procedure is just a function which returns void. So 'proc' is just a
shortcut for 'func void'. The hello world example program could be:

  $ include "seed7_05.s7i";

  const func void: main is func
    begin
      writeln("hello world");
    end func;

I will look over the use of the terms and explain them. Maybe exactly
at the place you mentioned: Paragraph 2.1.
Btw, in the file syntax.s7i is the definition of proc:

  const type: proc is func void;

The definition at syntax.s7i uses $ signs which I have omitted here
(The $ signs are necessary when booting the language, but this will
be another chapter...).

> In summary: I think you should focus more on people who are more
> knowledgeable about programming languages. I might be overrating the
> knowledge or underrating the curiousness of the average programmer,
> though.

You are right: On many places the manual is too focused on beginners.
I will change that, but it will take time.

Thank you very much for the feedback. Please give me more of it.
It helps me to improve the manual and the language.

Greetings Thomas Mertes

Seed7 Homepage:  http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch.




 1 Posts in Topic:
Re: Preview chapter about object orientation
thomas.mertes@[EMAIL PROT  2008-02-16 03:23:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 0:14:55 CDT 2008.