Compiler

Syndicate content 4 

In most cases, if one class depends on another, the class compiler will detect this and determine the correct compilation order. For example:

  • Compiling a superclass triggers compilation of its subclasses.
  • Compiling a custom datatype class triggers compilation of any classes with a property of that type.

Yet sometimes, a developer needs to specify compilation order. InterSystems class definitions contain two keywords for this, DependsOn and CompileAfter, that are very similar but not identical. They are useful during development, and also when importing and compiling a set of classes for the first time.

The documentation for these keywords is here

Last comment 31 January 2019
0 3
395

views

+ 4

rating

I have just imported our Ensemble project (not a really big one, like two man-years) into my MacBook Air  Ensemble 2016.3 instance to test many things (document model, etc.), Atelier among the others.

The "Production view" is not here, and I miss it.

The opening of Diagram Editor for BP is pretty hidden. I would even like having a switch, which would default to the Diagram Editor. 

Anytime I click on the Open Diagram Editor, it waits for a while, ten produces an error and only then I can see the diagram.

The error says: Your Studio browser is no longer valid... etc.

I cannot find an easy access to the Save or Compile command, once I do some changes in the respective BP via the Diagram Editor.

Compiling larger amount of classes produces an error: 

No conflicting files to resolve.

Compile failed: Gateway Timeout

Compiling identical set of classes "per partes" goes well, however

Last answer 6 December 2018
0 3
0

comments

273

views

+ 1

rating

Using our cool new debugging extension for Visual Studio Code I'm trying to debug a CreateProjection method of a class, but when I compile it the work apparently gets done in one of the worker jobs, so my breakpoint never triggers.

Is there a compiler flag or qualifier to force the compilation to be done in-process rather than getting handed off to a worker job?

Last answer 2 October 2018 Last comment 4 October 2018
0 3
186

views

+ 1

rating

Hi!

We need to use a bash script under Linux in order to export a namespace's clases (*.cls), project (*.prj), *.inc and all related stuff (except generated and mapped clases). All these elements must be stored on a XML file.

We need to use a bash script under Linux to import and compile previously exported XML file (from Studio, Management Portal, or Export Script) .

Can anyone help us to develop them?
Thanks in advance!

Last answer 23 December 2015 Last comment 29 December 2015
0 5
535

views

0

rating

I am using &html<> to output some CSS to my page (which is a class-based and not a tag-based page), and the selectors contain the '>' character which the compiler chokes on.  How can I escape the '>' so it still displays as such in the web page source but doesn't trip up the compiler?

This is for 2012.2 btw.

Last answer 20 November 2015 Last comment 20 November 2015
0 2
234

views

0

rating

When I try to compile through Atelier (Compile Project), I noticed that in compilation with error it returns this message 'Failed to read /api/atelier/v1/ ...':

No additional Atelier files to synchronize.
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck

Does anyone know what can it be?

I'm using Atelier beta (latest), with web application configured as Password Authenticated and a user with %ALL.

Last comment 24 July 2018
0 4
0

answers

215

views

+ 1

rating

Hi community!
Is there any way to create new method keywords?
For example:

ClassMethod TestOne() [ MyKeyword = MyValue ]
{
    // Implementation
}

Another doubt (maybe another topic)
How can I generate new methods at compilation time for the same class?
I tried method generators, but It only gets compiled when I compile for the second time.
I also read this comment but I could not find out how to generate the methods and get them compiled in the first compilation.

For example:

Class util.Test
{

ClassMethod TestOne()
{
    Write 1
}

ClassMethod TestTwo()
{
    Write 1
}

}

Expected

Last answer 12 June 2018 Last comment 14 June 2018
0 6
261

views

0

rating

Hi everyone

I'm coding a script in order to validade an installation package following the steps:

- Create environment { }
Try{
    - Import classes
    // Do some stuffs
    - Compile Classes
}Catch (ex){
    // oops ...
}
- Destroy environment { }

In some specific cases I will need to terminate the current process and start a new one with some new parameters.
With any code inside my try catch block, whenever I terminate the process I receive a RESJOB and it works perfectly.
When my job is running a compilation ($SYSTEM.OBJ.Compile(.classes)) and receive a RESJOB, it does not catch the exception. It just terminate, so the environment is not destroyed.

Any ideas on how to handle this situation

Last answer 28 May 2018 Last comment 26 May 2018
0 3
173

views

0

rating

During programmatic classes compilation performed by the code like this:

set status=$system.OBJ.Load(updaterFile,"cruk-d",,.resList)

strange messages appear in console log, e.g.

05/06/18-15:54:12:424 (308512) 0 oops: was expecting crc 0x21e96e85,5a4c8b2c for rtn (Update.Import.1) rbufnum-15523
...
05/06/18-16:17:45:305 (4224) 0 oops: was expecting crc 0x21e96e85,5a4c8b2c for rtn (Update.Import.1) rbufnum-15523
05/06/18-16:22:30:485 (4224) 0 oops: was expecting crc 0x21e96e85,5a4c8b2c for rtn (Update.Import.1) rbufnum-15523...(repeated 3 times)

Classes that were concerned stayed not compiled (with old object code untouched) till they were recompiled manually. To be fair, it happened only ones during several years

Last answer 7 May 2018 Last comment 8 May 2018
0 3
174

views

0

rating

Hi community.

I want to create a custom list inheriting %ListOfDatatypes in order to implement some methods like Map, Filter, ForEach, but I have some questions.
Just to mention, I have already read the topic about DeclarativeCOS.

When I define a property like following, caché uses %Collection.ListOfDT or %Collection.ListOfObj, as it's shown in the documentation

Property TestListString As list Of %String;

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_propcoll#GOBJ_propcoll_def.

So if I create a new instance of my class, or create from a JSON, those properties will not have my custom functions

I had this idea to get this done and it seems to work, but I'm not sure if this could cause any problem since it sets ^oddCO

Last answer 4 May 2018
0 2
0

comments

145

views

0

rating

Is there a way to enumerate the compilation status of a package?    

currently after deployment we are doing something like this to validate a successful load and compile of classes:

successful_compilation_count=`grep -a "Compilation finished successfully" output.log | wc -l`
successful_load_count=`grep -a "Load finished successfully" output.log | wc -l`

is there a method to do this where it is a little bit more elegant/dynamic without having to maintain counts for comparison ?

Last answer 13 March 2018 Last comment 15 March 2018
0 4
149

views

0

rating

In part of this post in 2016 @Eduard Lebedyuk asked if anyone knew what is meant by an "expanded class", as referred to in the text that appears when we run the ShowQualifiers classmethod of %SYSTEM.OBJ thus:

SAMPLES>DO $system.OBJ.ShowQualifiers()
...
            Name: /checkuptodate
    Description: Skip classes or expanded classes that are up-to-date.

Last answer 30 January 2018 Last comment 30 January 2018
0 3
150

views

0

rating

I am currently trying to add a condition to a routing rule that uses the %Source property of a routing rule.  Unfortunately I am getting compile errors when I use the "%", and if I get PROPERTY DOES NOT EXIST if I try and use any of field. I have tried referencing the messages as "Message." , "Record.",  "FullRecordMapClassName." , "Document." . Does anyone know how to reference the properties of a record map in a routing rule, or if it is even possible? Thanks!

Last answer 13 January 2018 Last comment 24 January 2018
0 4
264

views

0

rating

"Help me, Obi Wan Kenobi"?

I’ve hit the wall. I’m a one person shop who wants to start developing Cache on a mac using Eclipse/Atelier, after using Studio for the last 5 years. I’ve installed the 1.1 beta plugin, watched 6 or 7 videos from the September conference, tried several times to work through the cheat sheets, only to have connection issues or compilation issues, so at this point, I’m feeling very frustrated. The videos were interesting, but generally didn’t work as tutorials for fundamental programming operations, for me.

I feel comfortable with Objectscript and Zen development in Studio. What I need are step by step Atelier instructions, such as have been offered in previous excellent Cache tutorials to:

1. Run compiled Cache class and routine serverside code and see its output on a Terminal equivalent.
2. Run compiled CSP/Zen code and see its output to a web browser

Last answer 13 November 2017 Last comment 14 November 2017
0 1
151

views

0

rating

hi-

Can someone give me an example of how to JOB a class method that requires an array of values to be passed to it by reference.  

This is what I tried, but am getting compile errors because of the .params

job ##class(%SYSTEM.OBJ.FM2Class).All(.params)::5

Any thoughts on how to accomplish this, the simplest way.  I would like to avoid writing all of this to some global and having to write some wrapper to pick it up and then call the class method, which I certainly could do.  but is this the only way to do it?

Last answer 2 October 2017 Last comment 2 October 2017
0 2
421

views

0

rating

The definitions of these two compiler keywords looks very similar to me.

Is there any difference between these two keywords ?

When I declare a parent class as Abstract, its child class could be compiled successfully.

However, when I  declare a parent class as NoExtent, some compile errors about storage references get pop up for its child classes.

Thanks.

Last answer 27 September 2017
0 1
0

comments

126

views

0

rating

I'm looking at adding multilingual support to a couple of open source projects I'm working on. The solutions are already developed in CSP so I am not looking for alternative approaches.

I'm wondering what would be the best approach for CSP and separate JavaScript files.

Initially I was wondering if I should bake the default system language text at compile time, or provide the end user with a language selection option at run time.

I came across $$$TEXT reading the docs...

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...

and have also discovered the localization manager which looks to be really handy...

https://community.intersystems.com/post/cach%C3%A9-localization-manager-...

Last answer 11 May 2017 Last comment 12 September 2017
0 1
254

views

+ 1

rating

I am trying to import the SalesForce Enterprise WSDL in InterSystems Ensemble Studio using the SOAP Add-In. However, when I do so I receive a class dependency loop, Error #5316 during compilation. The WSDL is the standard WSDL provided with SalesForce and works fine in SoapUI. In the SalesForce WSDL it is allowed for an object A to include an object B as an element, while at the same time object B is allowed object A as an element. I think this is what causes the class dependency loop for InterSystems. Does anyone has any suggestion how I can circumvent this error? Rewriting the WSDL is not an option as it includes over 900 objects which all refer to at least 10 other objects.

Here is the error

Last answer 15 August 2017 Last comment 15 August 2017
0 3
290

views

0

rating

In this article I would like to tell you about macros in InterSystems Caché. A macro is a symbolic name that is replaced with a set of instructions during compilation. A macro can “unfold” in various instruction sets each time it is called, depending on the parameters passed to it and activated scenarios. This can be both static code and the result of ObjectScript execution. Let's take a look at how you can use them in your application.

Last comment 24 July 2017
0 5
1007

views

+ 8

rating

Hi all,

 

I was wondering if there is any way to trigger the compilation of a class based on the compilation of another (unrelated) class. For example:

Class 1 = test.class

Class 2 = test.class.type.one

Class 3 = test.class.type.two

Every time class 2 or class 3 is compiled in Studio I would like to have class 1 automatically compiled as well.

 

The reason I need this is because class 1 has a method with CodeMode set to objectgenerator which generates some code based on what is found in classes 2 and 3.

Last answer 18 July 2017 Last comment 19 July 2017
0 3
228

views

0

rating

I have a class and I would like to dynamically change its selectivity attribute in run-time and then call $system.OBJ.Compile to

recompile the class. I have changed the selectivity to a global, but it seems like it does not work. Any suggestions? Thanks.

 

<Property name="field1">
<AverageFieldSize>8.91</AverageFieldSize>
<Selectivity>^selectivity</Selectivity>
</Property>
 

Last answer 18 July 2017 Last comment 18 July 2017
0 2
160

views

0

rating

Hi everyone

Is there any way to change a class definition (especifically a query definition during the compilation time)?
The idea is: 
    I have an abstract class with a parameter where I will define the ROWSPEC of a query and some methods to populate e temporary table
The implementation class will override the parameter, specifying the ROWSPEC of this implementation, and the methods will populate the rows in the same format as the ROWSPEC.

I want to change the ROWSPEC of the inherit query according to the implementation of the overriden parameter.
What I've already tried to change the parameter definition (of the query):
- Create a macro, thinking about the possibility of running it before the compilation
- Override the ClassMethod CreateProjection from the class %Projection.AbstractProjection
- Run a method in a objectgenerato

Last answer 14 July 2017 Last comment 17 July 2017
0 2
233

views

0

rating

This is a translation of the following article. Thanks @Evgeny Shvarov  for the help in translation.

Let's assume that you wrote a program that shows "Hello World!", for example:

  write "Hello, World!"

The program works and everyone is happy.

With time, however, your program becomes more complex, gets more features and you eventually need to show the same string in different languages. Moreover you don't know the number and names of these languages.

The spoiler below contains a description of how the task of multi-language localization is solved in Caché.

Last comment 20 May 2017
0 1
295

views

+ 7

rating

I wonder if you could help me? I have a regular cache class that accepts a variable number of arguments in one of the methods. It works fine so I decided to add a method to my web service to make the call to the cache class. I get a compile error on the web service with error#5130.

Here is the cache clas

Last answer 20 April 2017
0 2
0

comments

324

views

0

rating

On the back of my recent post on writing bug-less code I wanted to raise a few suggestions (to ISC) that would help prevent certain types of bugs at compile time. I've probably missed a few, but these are the main ones in my mind. Please contribute more suggestions.

Btw, these also serve as potential gotchas for new COS developers.

I except that introducing these types of changes can cause legacy code problems. Particularly where developers do some interesting overloading of method arguments. Therefore I would see these as an option that would need to be enabled and that it won't prevent compilation (it would warn not error).

As an alternative I could see these being implemented as a Lint tool. This is something I (and perhaps the community) would be willing to do if we had an open source AST tree as a starting block (if anyone is aware of one in existence for COS)

Last comment 18 April 2017
0 1
666

views

+ 4

rating

I have classes A and B, B derived from A, A has method Abc.

From INT of class B I see that compiler copies implementation of Abc to class B, so that Abc exists both in A and B.

As result, when B invokes Abs, B.Abs() is executed instead of A.Abs(). In result debuger is not able to step into Abs and breakpoints in A.Abs never hit.

Why this happens and how can I avoid this?

Update:

OK, now I know the reason: compiler makes the copy if Abc has this line:

cn=##Expression($$$quote(%classname))

hmmmm... compiler needs name of method's class so it "moves" the method to child class. Well, perhaps there is a good reason for that but for the moment the solution looks strange

Last answer 12 April 2017 Last comment 12 April 2017
0 4
193

views

0

rating