Use of [noDefaultConstructor]

Discussions related to Visual Prolog
Harrison Pratt
VIP Member
Posts: 285
Joined: 5 Nov 2000 0:01

Use of [noDefaultConstructor]

Unread post by Harrison Pratt » 6 Jan 2016 15:18

The Language Reference is not completely clear on use of noDefaultConstructor. It took me a while to sort out that it needs to follow the open statements. Perhaps the LR could be clarified on the next iteration of VIP.

Code: Select all

class graphParms : graphParms             [noDefaultConstructor]                 open core   % <== SYNTAX ERROR HERE     open vpiDomains   constructors       new : ( string GraphTypeID ).     new_fromFile : ( string QFN ).
This compiles without error:

Code: Select all

class graphParms : graphParms       open core     open vpiDomains               [noDefaultConstructor]  % <== Must follow 'open' statements   constructors       new : ( string GraphTypeID ).     new_fromFile : ( string QFN ).

User avatar
Thomas Linder Puls
VIP Member
Posts: 1625
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 6 Jan 2016 16:11

To a (lazy) person that already know where to write such attributes and who also have to write the language reference; it seem sufficient to write:
The attributes of interfaces, classes and implementations are right after the scope qualifications.
Which is what that lazy person ;-) wrote in the language reference: Attributes: Insertion Points.

But in reality it clearly is not sufficient. Maybe you could assist with suggesting what (in some details) you think would have helped you. (E.g. a better formulation; another location to write about it; explicit examples).
Regards Thomas Linder Puls
PDC

Harrison Pratt
VIP Member
Posts: 285
Joined: 5 Nov 2000 0:01

Unread post by Harrison Pratt » 6 Jan 2016 19:14

Thomas,
Here's what led me astray:
http://wiki.visual-prolog.com/index.php ... onstructor

Example
class classWithoutPublicConstructors : myInterface
[noDefaultConstructor]
...
end class classWithoutPublicConstructors


In that example, the close spacing between the class declaration and [noDefaultContructor] led me to believe that [noDefaultConstructor] should immediately follow the declaration.

I did not think to search for Insertion Points ... actually, I had never read that until now! (oops!)

Perhaps modifying the example to read somewhat like the following would help:

Example
class classWithoutPublicConstructors : myInterface
open core
[noDefaultConstructor]
...
end class classWithoutPublicConstructors

User avatar
Thomas Linder Puls
VIP Member
Posts: 1625
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 7 Jan 2016 22:32

Yes, good idea. I have done that.
Regards Thomas Linder Puls
PDC

Harrison Pratt
VIP Member
Posts: 285
Joined: 5 Nov 2000 0:01

Unread post by Harrison Pratt » 8 Jan 2016 4:30

You are too hard on the people who compiled the excellent on-line reference material -- it is hard for experts to anticipate all the possible misinterpretations made by amateurs! :lol:

Post Reply