1. Don't understand manual.

Hello Everybody,

English being my native language, I don't understand this.

From the manual:

If the keyword public precedes the declaration, the scope extends to any file that explicitly includes the file in which the identifier is declared, or to any file that includes a file that in turn public includes the file containing the public declaration.

Don Cole

new topic     » topic index » view message » categorize

2. Re: Don't understand manual.

DonCole said...

Hello Everybody,

English being my native language, I don't understand this.

From the manual:

If the keyword public precedes the declaration, the scope extends to any file that explicitly includes the file in which the identifier is declared, or to any file that includes a file that in turn public includes the file containing the public declaration.

Don Cole

I think this has been written in abbreviated legalese. It is technically correct but as obtuse as possible.

Try this ...

said...

A declaration of an identifier, when it doesn't have any qualifiers, allows that identifier to only be seen by statements in the same file as the declaration. However, by putting the qualifier public in front of a declaration, allows the identifier to also be seen by statements in files that explicitly include the file containing the declaration.

For example:

alpha.e said...
public constant XY = 1 
constant ZA = 2 

Of course, statements inside alpha.e can seen both XY and ZA.

beta.e said...
include alpha.e 
? XY  -- Ok, because it was declared as 'public' 
? ZA  -- Fails, because it is only visible inside alpha.e 

Note that normally, public declarations can only been seen via direct, explicit include statements. This means that if a file, e.g. gamma.e included beta.e, then XY could not be seen by gamma.e's statements because the public declaration is only opened up to one level of includes.

However, Euphoria has a way of exposing public declarations up one further level. You do this by using public as a qualifier to the actuall include statement itself.

If we change beta.e slightly ...

beta.e said...
public include alpha.e 
? XY  -- Ok, because it was declared as 'public' 
? ZA  -- Fails, because it is only visible inside alpha.e 
gamma.e said...
include beta.e 
? XY  -- Ok, because it was declared as 'public' in alpha.e AND publicly included in beta.e 
? ZA  -- Fails, because it is still only visible inside alpha.e 

The purpose of public include is to allow developers to create a library that actually consists of many sub-library files. This makes the application usage easier because only the top-level library file need be included in the application.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Don't understand manual.

DonCole said...

Hello Everybody,

English being my native language, I don't understand this.

From the manual:

If the keyword public precedes the declaration, the scope extends to any file that explicitly includes the file in which the identifier is declared, or to any file that includes a file that in turn public includes the file containing the public declaration.

Don Cole

The phrase, 'public include' is not a verb. Those of us who worked to develop this can be poor at explaining the new syntax.

Shawn Pringle


Forked into: Too many namespaces

new topic     » goto parent     » topic index » view message » categorize

4. Re: Don't understand manual.

DerekParnell said...

I think this has been written in abbreviated legalese. It is technically correct but as obtuse as possible.

Try this ...

said...

A declaration of an identifier, when it doesn't have any qualifiers, allows that identifier to only be seen by statements in the same file as the declaration. However, by putting the qualifier public in front of a declaration, allows the identifier to also be seen by statements in files that explicitly include the file containing the declaration.

For example:

alpha.e said...
public constant XY = 1 
constant ZA = 2 

Of course, statements inside alpha.e can seen both XY and ZA.

beta.e said...
include alpha.e 
? XY  -- Ok, because it was declared as 'public' 
? ZA  -- Fails, because it is only visible inside alpha.e 

Note that normally, public declarations can only been seen via direct, explicit include statements. This means that if a file, e.g. gamma.e included beta.e, then XY could not be seen by gamma.e's statements because the public declaration is only opened up to one level of includes.

However, Euphoria has a way of exposing public declarations up one further level. You do this by using public as a qualifier to the actuall include statement itself.

If we change beta.e slightly ...

beta.e said...
public include alpha.e 
? XY  -- Ok, because it was declared as 'public' 
? ZA  -- Fails, because it is only visible inside alpha.e 
gamma.e said...
include beta.e 
? XY  -- Ok, because it was declared as 'public' in alpha.e AND publicly included in beta.e 
? ZA  -- Fails, because it is still only visible inside alpha.e 

The purpose of public include is to allow developers to create a library that actually consists of many sub-library files. This makes the application usage easier because only the top-level library file need be included in the application.

Thank you Derek,

Your explination is much clearer.

This is the problem I keep having version 4.

include std\text.e 
include win32lib.ew 
 
manyDifferentPrograms.eui 

I get lots upper errors from w32msgs.e, options.e, w32resources.ew, w32forms.ew and w32xpm.ew.

upper is a public function in std\text.e
Win32lib.ew is really win32lib_0_70_20.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

5. Re: Don't understand manual.

DonCole said...

This is the problem I keep having version 4.

include std\text.e 
include win32lib.ew 
 
manyDifferentPrograms.eui 

I get lots upper errors from w32msgs.e, options.e, w32resources.ew, w32forms.ew and w32xpm.ew.

upper is a public function in std\text.e
Win32lib.ew is really win32lib_0_70_20.

I can't reproduce the issue. Here is the code that I tested with ...

include std/text.e 
include win32lib.ew 
 
sequence x 
x = upper("abc") 
 
printf(1, x) 

This didn't fail and it did display "ABC".

What is the exact error message you are getting?

new topic     » goto parent     » topic index » view message » categorize

6. Re: Don't understand manual.

DonCole said...

From the manual:

If the keyword public precedes the declaration, the scope extends to any file that explicitly includes the file in which the identifier is declared, or to any file that includes a file that in turn public includes the file containing the public declaration.

Agreed, this is hard to understand as written.

Take a look at http://openeuphoria.org/wiki/view/Three%20File%20Scope%20Example.wc (a miniguide in the wiki).

Does this explanation of export compared to public make sense to you?

_tom

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu