TWiki
>
P1076 Web
>
VHDL2017
>
LCS2016_033
>
LCS2016_033_history
(2017-07-16,
JimLewis
)
(raw view)
E
dit
A
ttach
---+ Language Change Specification for Composition with Protected Types ---++ | <sticky><b>LCS Number:</b></sticky> | LCS-2016-033 | | <sticky><b>Version:</b> </sticky> | 2 {11-Feb-2017} <span data-mce-mark="1">%BR%</span> 1 {26-Dec-2016} | | <sticky><b>Date:</b> </sticky> | 11-Feb-2017 | | <sticky><b>Status:</b> </sticky> | Voting | | <sticky><b>Author:</b> </sticky> | Jim Lewis | | <sticky><b>Email:</b> </sticky> | [[Main.JimLewis]] | | <sticky><b>Source Doc:</b></sticky> | [[ProtectedTypeComposition][Composition with Protected Types]] | | <sticky><b>More Doc:</b></sticky> | [[LCS2016_033_history][history]] | | <sticky><b>Summary:</b> </sticky> | Composition with Protected Types | ---+++ Voting Results: Cast your votes here Yes: 1 <span data-mce-mark="1">%USERSIG{JimLewis - 11-Feb-2017}%</span> - ver 2 1 <span data-mce-mark="1">%USERSIG{TorstenMeissner - 2016-12-27}%</span> - ver 2 1 <span data-mce-mark="1">%USERSIG{PatrickLehmann - 2017-02-16}%</span> - ver 2 1 %USERSIG{RobGaddi - 2017-03-21}% - ver 2 No: 1 Abstain: 1 %USERSIG{LievenLemiengre - 2017-02-16}% - ver 2 1 %USERSIG{HendrikEeckhaut - 2017-02-16}% - ver 2 1 %USERSIG{BrentHahoe - 2017-02-16}% Version 2 - Abstain due to lack of personal time for review. <sticky> ---+++ Revision Notes Revision 2: * Changes variable to private variable * Updated most paragraphs to reflect this. * Added section on elaboration to clarify which object is locked when calling an object via an alias. ---+++ Comments Variables should not be exposed on a public interface. The better way to allow externally visible nesting is a function returning an access type to the inner protected type. Other languages call this a getter or read-only property. -- %BUBBLESIG{PatrickLehmann - 2017-01-25}% @PL: The heart of this proposal is to allow variables of a protected type in the declarative region of another protected type. Then to allow aliases to the methods of the variables of the protected type. This is accomplished by the BNF and the restriction P58 that requires the variable to have a protected type. Note that in VHDL sequential code, such as a protected type body, process, or subprogram body, protected typed objects are referenced by regular variables and not shared variables. -- %BUBBLESIG{JimLewis - 2017-01-26}% @Patrick, Lieven, and Hendrik, First note, the variable made visible is not a regular variable it is a protected type. Next, what this does is create a public variable of a protected type - something that many other class based languages allow. Next, the alternative is brutal. One must manually create the layering by putting a variable in the protected type body and creating accessor functions. Which in VHDL means creating the declaration and the body. -- %BUBBLESIG{JimLewis - 2017-01-27}% @Jim From a software standpoint it's no good idea to have public variables. Languages that expose public variables are mostly transforming them into invisible getter methods. I'll need some days to think about your goals, what other languages do or could offer and how it fit's into the VHDL concept. So please understand my vote as "put on hold" but not as a 100% down vote. Your proposed use case also touches the concepts of inheritance and multiple inheritance (mix-ins) with renaming. I just want to make sure for my self, that we don't make false design decisions as done for shared variables and protected types in 2002... -- %BUBBLESIG{PatrickLehmann - 2017-01-27}% @PL To have a good technical discussion, you need to provide more details about the issues you are trying to illuminate. From what I found, the issue has to do with issues if the reference PT changes - either methods or parameter names on the methods - could potentially break the usage. I have some thoughts about making the variable private (not too difficult) and creating a shorthand subprogram that provides its own parameter names rather than using the name of the referenced object like an alias does. Not sure I will get them developed on time for this revision though. -- %BUBBLESIG{JimLewis - 2017-01-29}% @Jim: Having public variables is ok, but such variables will not be part of the shared data of the protected type as defined in clause 5.6.1 because exclusive access cannot be guaranteed for these public shared variables. For example, if you have: <verbatim> type PT is protected shared variable v1 : some_PT1; shared variable v2 : some_PT2; procedure p; end protected; -- body declaration shared variable sv : PT; </verbatim> One process can call a method on =sv.v1=, wheres another one can call a method on =sv.v2=, and a third one can call a method on =sv= --- *all at the same time!* Is this what you want? -- %BUBBLESIG{MartinZabel - 2017-01-29}% @MZ No. That would be bad as there can be dependencies that result in deadlock. If the prefix contains sv, we can restrict it in the same way that calls to methods are restricted. In addition, we would need to forbid the creation of pointers to sv.v1 and sv.v2 - ie if 014b comes to fruition, then we need to disallow it here. -- %BUBBLESIG{JimLewis - 2017-01-31}% @MZ Reflecting on your example, it is safe to call sv.v1.a1 and sv.v2.b1 simultaneously since they are independent objects. However, the method p may also call a method of v1 or v2. As a result, if a method of sv.v1 is called, it must lock sv in order to prevent calls to method p. This all becomes a mute point with version 2 since the variable are no longer visible - only aliases to methods within the variables are visible. Hence, there is no longer a sense of independent variables - and perhaps that is exactly how it should be. -- %BUBBLESIG{JimLewis - 2017-02-11}% Updated to revision 2. Variables are now private and required to be labeled as such. -- %BUBBLESIG{JimLewis - 2017-02-11}% I think the following sentence should be more specific: %BR% An alias declaration %RED%in a protected type declarative region%ENDCOLOR% may make a method of the private variable %RED%holding a protected type instance%ENDCOLOR% visible. Should this sentence:%BR% <i>It is an error if an alias defined inside of the protected type denotes anything other than a method of a protected type.</i>%BR% be in the alias section? -- %BUBBLESIG{PatrickLehmann - 2017-02-16}% %COMMENT%</sticky> </noautolink>
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2017-07-16 - 05:19:21 -
JimLewis
P1076
Log In
or
Register
P1076 Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Main
P1076
Ballots
LCS2016_080
P10761
P1647
P16661
P1685
P1734
P1735
P1778
P1800
P1801
Sandbox
TWiki
VIP
VerilogAMS
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback