Quantcast

Compiler declarations in v13

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Compiler declarations in v13

Paul Chernoff
I am working on moving my first conversion of a database from 4D v12 to v13. This database dates back to 4D 2004.

I am now seeing many errors that state:

The parameter $1 has not been explicitly declared in the typing methods (Compiler...).

I declare variables and parameters in each method itself. The variable declarations are recognized but not the paramter declarations. S how should I declare parameters?

I have been thinking of declaring everything in a Compiler method but it hasn't been recognized by the compiler and I thought 4D prefers you put the declarations in a Compiler method. What is the best way of making the declarations?


Paul Chernoff
Director of Information Technology
Washingtonian Media
202.862.3504



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Jeremy Roussak
There's nothing wrong with declaring parameters within the methods: I do it routinely:

C_LONGINT($1;$foo)

I then click "generate typing" in the Compiler dialog. I do find that sometimes the typing generation doesn't work properly, in which case I delete the automatically-generated typing methods and try it again. Have you tried that? Just a thought.

Jeremy


Jeremy Roussak
[hidden email]

On 12 Jun 2013, at 15:49, Paul Chernoff <[hidden email]> wrote:

> I am working on moving my first conversion of a database from 4D v12 to v13. This database dates back to 4D 2004.
>
> I am now seeing many errors that state:
>
> The parameter $1 has not been explicitly declared in the typing methods (Compiler...).
>
> I declare variables and parameters in each method itself. The variable declarations are recognized but not the paramter declarations. S how should I declare parameters?
>
> I have been thinking of declaring everything in a Compiler method but it hasn't been recognized by the compiler and I thought 4D prefers you put the declarations in a Compiler method. What is the best way of making the declarations?


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Arnaud de Montard
In reply to this post by Paul Chernoff

Le 12 juin 2013 à 16:49, Paul Chernoff a écrit :

> I declare variables and parameters in each method itself. The variable declarations are recognized but not the paramter declarations. S how should I declare parameters?

If you want to declare all, then *every* method with parameters ($0, $1…) must be declared in a method named "COMPILER_methods".

say, for example, I have that (stupid) method:

  //divideBy10 (real) -> real
  C_REAL($0)  //out
  C_REAL($1)  //in
  $0:=$1/10

then in the "COMPILER_methods" method I must have:

  C_REAL(divideBy10;$0)
  C_REAL(divideBy10;$1)

See "Generate Typing button" here to make it automatic:
<http://doc.4d.com/4D-Design-Reference-13/Compilation/Compiler-window.300-832569.en.html>

--
Arnaud de Montard



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Chuck Miller-2
In reply to this post by Jeremy Roussak
I think it is asking form

C_LONGINT(method_name ;$2)

On Jun 12, 2013, at 11:03 AM, Jeremy Roussak wrote:

>
> C_LONGINT($1;$foo)
>
> I then click "generate typing" in the Compiler dialog. I do find that sometimes the typing generation doesn't work properly, in which case I delete the automatically-generated typing methods and try it again. Have you tried that? Just a thought.

------------------------------------------------------------------------------------------------
 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064      
 PO Box 1720 mailto:cjmiller<AT SIGN>informed-solutions.com
 Brookline, MA 02446 USA Registered 4D Developer                
       Providers of 4D and Sybase connectivity
          http://www.informed-solutions.com 
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law.  These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited.  Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication.





**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Ben Kershaw-3
In reply to this post by Paul Chernoff
Arnaud de Montard wrote:

>If you want to declare all, then *every* method with parameters ($0, $1
>) must be declared in a method named "COMPILER_methods".

The method name must begin with "compiler", but it does not have to be named "compiler_methods" (that's just 4D's default).

I use module prefixes for my project methods, and each module has its own 'compiler_xxx" method where 'xxx' is the module prefix.

Regards,
Ben Kershaw
**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Arnaud de Montard
In reply to this post by Jeremy Roussak

Le 12 juin 2013 à 17:03, Jeremy Roussak a écrit :

> There's nothing wrong with declaring parameters within the methods

BTW, I don't understand why, once we've done that, do we have to paint another layer with COMPILER_methods  :-(
What's the reason?

--
Arnaud de Montard



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Jeremy Roussak
In reply to this post by Chuck Miller-2
Chuck,

You're right: that's what "generate typing" generates, in the Compiler_xx methods.

Jeremy


Jeremy Roussak
[hidden email]

On 12 Jun 2013, at 16:11, Chuck Miller <[hidden email]> wrote:

> I think it is asking form
>
> C_LONGINT(method_name ;$2)
>
> On Jun 12, 2013, at 11:03 AM, Jeremy Roussak wrote:
>
>>
>> C_LONGINT($1;$foo)
>>
>> I then click "generate typing" in the Compiler dialog. I do find that sometimes the typing generation doesn't work properly, in which case I delete the automatically-generated typing methods and try it again. Have you tried that? Just a thought.
>


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Jeremy Roussak
In reply to this post by Arnaud de Montard
Arnaud, I agree. I just use it. I didn't design it. Don't blame me!

Jeremy


Jeremy Roussak
[hidden email]

On 12 Jun 2013, at 16:24, Arnaud de Montard <[hidden email]> wrote:

>
> Le 12 juin 2013 à 17:03, Jeremy Roussak a écrit :
>
>> There's nothing wrong with declaring parameters within the methods
>
> BTW, I don't understand why, once we've done that, do we have to paint another layer with COMPILER_methods  :-(
> What's the reason?


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Arnaud de Montard
In reply to this post by Ben Kershaw-3

Le 12 juin 2013 à 17:20, Ben Kershaw a écrit :

> The method name must begin with "compiler", but it does not have to be named "compiler_methods" (that's just 4D's default).
>
> I use module prefixes for my project methods, and each module has its own 'compiler_xxx" method where 'xxx' is the module prefix.

You don't have to "put them in the hat"?

I mean, like this:

//COMPILER_methods

COMPILER_myModule1
COMPILER_walkingTheDog
COMPILER_teethBrusher

?

--
Arnaud de Montard



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Arnaud de Montard
In reply to this post by Jeremy Roussak

Le 12 juin 2013 à 17:40, Jeremy Roussak a écrit :

> Arnaud, I agree. I just use it. I didn't design it. Don't blame me!

it's a pity, nobody wants to be responsible!  ;-)

--
Arnaud de Montard



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Bruno LEGAY
In reply to this post by Paul Chernoff
Hi,

> say, for example, I have that (stupid) method:
>
>  //divideBy10 (real) -> real
>  C_REAL($0)  //out
>  C_REAL($1)  //in
>  $0:=$1/10
>
> then in the "COMPILER_methods" method I must have:
>
>  C_REAL(divideBy10;$0)
>  C_REAL(divideBy10;$1)

I have seen people using this. And it has been bugging me for a while.

I declare my parameters within the method but not un the  "COMPILER_methods" method. The code I work on compiles fine and runs compiled without any problem.

I don't understand why. My feeling is that it was a trick make compile time faster when using the old and slow compiler/computer (15 years ago).

Is it one of these habits that don't get questioned/re-evaluated ?

Today I get the feeling this is completely redundant (and a big waste time)...

Did I miss something ?

Bruno
**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Ben Kershaw-3
In reply to this post by Paul Chernoff
Arnaud de Montard wrote:

>BTW, I don't understand why, once we've done that, do we have to paint another layer with COMPILER_methods  :-(
>What's the reason?

I don't know this for a fact, but I'll guess two reasons: #1 is speed of compiling, and #2 is a bit of laziness on the part of the 4D programming team. If you remember the old compiler, it would have to make (depending on your settings) multiple passes through the source code for things like process/interprocess variables, locals, parameters, etc.

If all of the parameter declarations are in methods that the compiler can quickly identify based on a known prefix ('compiler_'), then it doesn't have to scan the source code (which would be yet another pass). It could build the list of known parameters during one of the passes, but if it gets to a method call it hasn't seen yet, it would have to then parse that method, which might mean running into other methods it hasn't parsed yet, which.... you get the idea.

That would make it easier on us, but harder on the 4D programmers. You see which one won. ;)

Regards,
Ben Kershaw
**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Paul Chernoff
In reply to this post by Paul Chernoff
Thanks everyone. After I posted my request I noted the Generate Typing button on the Compiler. That fixed everything for me.

Paul Chernoff
Director of Information Technology
Washingtonian Media
202.862.3504



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Compiler declarations in v13

Arnaud de Montard
In reply to this post by Bruno LEGAY

Le 12 juin 2013 à 19:32, Bruno LEGAY a écrit :

> Hi,
>
>> then in the "COMPILER_methods" method I must have:
>> C_REAL(divideBy10;$0)
>> C_REAL(divideBy10;$1)
>
> I have seen people using this. And it has been bugging me for a while.
>
> I declare my parameters within the method but not un the  "COMPILER_methods" method. The code I work on compiles fine and runs compiled without any problem.
>
> I don't understand why. My feeling is that it was a trick make compile time faster when using the old and slow compiler/computer (15 years ago).
>
> Is it one of these habits that don't get questioned/re-evaluated ?
>
> Today I get the feeling this is completely redundant (and a big waste time)...
>
> Did I miss something ?

don't know. For my own, I used the "all declared" in components (to see…) but not in older and bigger apps - it would take too much time! If the only interest is compilation time (doc says 50%), I'd prefer save 50% in "engining" time!  :-/

--
Arnaud de Montard



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Loading...