Design #1495
Package exporting nothing?
Description
It may be useful to make a package exporting no function: currently it gives a warning.
Choose an explicit syntax to make it safe and silent.
Related issues
History
#1 Updated by Anna Maria Bigatti over 3 years ago
- Related to Design #1477: Packages: questions from Andraschko added
#2 Updated by Anna Maria Bigatti over 3 years ago
- Category set to enhancing/improving
- Status changed from New to In Progress
- Assignee set to John Abbott
- Target version set to CoCoA-5.4.0
- % Done changed from 0 to 10
- Estimated time set to 3.00 h
From #1477 point (C)
proposed syntax export skip;
#3 Updated by John Abbott over 3 years ago
- % Done changed from 10 to 30
I have written a first prototype. It compiles and seems to do the right thing, but I must do some more testing.
The lexer+parser+interpreter is "self-documenting" :-(
#4 Updated by John Abbott over 3 years ago
- (1) package with no
export
commands (warning, as now) - (2) package with just
export skip
(now warning, exports nothing) - (3) package with export name(s) followed by
export skip
(error) - (4) package with
export skip
followed by moreexport
commands - (5)
export
followed by several names inclskip
(or evenskip
appearing more than once) - (6) similar to above but
export
being called "too late" in the file
#5 Updated by John Abbott over 3 years ago
Prototype still needs to be cleaned... not today!
#6 Updated by John Abbott over 3 years ago
- % Done changed from 30 to 50
I am writing tests for package
, and have a question.
If the input contains something like export abc,skip;
,
an error is reported (cannot "skip" and export names).
My current impl then goes on to check that the fn abc
is actually defined (if not, a second error is generated).
If the input is export skip,abc;
then there is no check that abc
is actually defined.
Actually, in this case the error mesg says that it expected a semicolon after skip
(which is correct, but perhaps not entirely helpful?)
Comments? Opinions?
#7 Updated by John Abbott over 3 years ago
- Related to Support #1498: Export many names or just one? added
#8 Updated by John Abbott over 3 years ago
- Related to Design #1501: testing for syntax errors added
#9 Updated by John Abbott over 3 years ago
I seem to have lost the test file I used for the revised package parser. Here is a short version:
package $pkg1; export skip; endpackage; -- correct package $pkg2; endpackage; -- warning: no exports package $pkg3; export skip; export abc; endpackage; -- error: cannot export after skip package $pkg4; export abc; export skip; endpackage; -- error: cannot export skip after exporting names package $pkg5; export skip; export skip; endpackage; -- error cannot export after skip !!OBSOLETE!! package $pkg6; export abc,skip; endpackage; -- error unexpected keyword !!OBSOLETE!! package $pkg7; export skip,abc; endpackage; -- error expected semicolon
PS when an error occurs, it seems that we do not need endpackage
... at least the keywprd endpackage
triggers another error (not so helpful)
NOTE no longer allow many names after export
-- see issue #1498
#10 Updated by John Abbott over 3 years ago
- Status changed from In Progress to Feedback
- % Done changed from 50 to 90
I have checked in my code (after some ad hoc testing).
I have slightly changed what we agreed via skype (so that the inpl would be simpler and clearer, but the error mesgs should still be fairly helpful).
#11 Updated by Anna Maria Bigatti over 3 years ago
- Status changed from Feedback to Closed
- % Done changed from 90 to 100
- Estimated time changed from 3.00 h to 3.51 h
Tested. OK.