top of page
Search

Hiding SCL blocks

  • Writer: Ivaylo Fiziev
    Ivaylo Fiziev
  • 19 hours ago
  • 2 min read

By design SCL lacks access modifiers - a common feature that is available in most of the modern programming languages. But what are access modifiers on the first place? These are the keywords that you use when you want to limit the visibility of a function or a class. e.g. public, private, internal.

By default SCL threats all blocks as public. Recently this limitation became obvious in the context of Process Simulate. We have some blocks that that should not be public. They are for internal use only. They do not bring a direct value to the user but the system needs them. This means that the blocks are still placed in the vault but are not included in the auto completion candidates or the list of data types in the SCL editor.

In other words these blocks are hidden.


To address this limitation we have introduced a new system attribute that can be put on all blocks.

FUNCTION "Foo" : BOOL
VERSION:1.1
{ AccessModifier := 'internal' }
VAR_INPUT
...

Possible values are:

  • public – block is executable and visible in the UI

  • internal – block is executable but is not visible in the UI


For blocks implemented over the extensibility API, there is a new interface that you need to implement:

	[
        ComVisible(true),
        ClassInterface(ClassInterfaceType.AutoDual)
    ]
    public class MyFC : ISCLFunctionHandler, ISCLPouTraits
    {
       …
		public SclAccessModifier AccessModifier => 	SclAccessModifier.Internal;
    }

If you don't provide the attribute or do not implement the new interface, blocks are still public.


Version 2612 will have this feature.


The good thing about this change is that we do not change the language syntax but still achieve the goal. Of course this will work only in the context of Process Simulate.

See you!

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Subscribe Form

Thanks for submitting!

bottom of page