Implicit Typing would be nice to have

View: New views
12 Messages — Rating Filter:   Alert me  

Implicit Typing would be nice to have

by George Tiller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It would sure be nice if we had a command like this:

C_REAL("r@")

and

C_TEXT("@_t")

which would implicitly type all variables whose names began with, or that
ended with a particular string.

30+ years ago, I could easily do this in Fortran:

IMPLICIT INTEGER (i,j,k)



George Tiller
911 East A Street
Brunswick, Maryland 21716


**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Implicit Typing would be nice to have

by Peter Jakobsson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 4 Nov 2009, at 04:10, George Tiller wrote:

> It would sure be nice if we had a command like this:
>
> C_REAL("r@")


I think 4D decided that if your a fortran programmer, you won't be  
needing variable names longer than 1 letter anyway and so haven't  
implemented this feature :)

For more info see http://www.pbm.com/~lindahl/real.programmers.html

Peter

**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

RE: Implicit Typing would be nice to have

by garrio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


At the summit, Miyako demoed a macro that would run thru a method and type the variables for you.  I believe his variables were denoted by the _Type naming convention but the macro could be changed if some other naming convention was used.  It isn't what you are asking but it can help for typing variables in a method which is the result you want.

> Date: Tue, 3 Nov 2009 22:10:16 -0500
> From: gtiller_erols@...
> To: 4D_Tech@...
> CC:
> Subject: Implicit Typing would be nice to have
>
> It would sure be nice if we had a command like this:
>
> C_REAL("r@")
>
> and
>
> C_TEXT("@_t")
>
> which would implicitly type all variables whose names began with, or that
> ended with a particular string.
>
> 30+ years ago, I could easily do this in Fortran:
>
> IMPLICIT INTEGER (i,j,k)
>
>
>
> George Tiller
> 911 East A Street
> Brunswick, Maryland 21716
>
>
> **********************************************************************
> Get the speed and power of 4D v11 SQL
> before upgrade prices increase - http://www.4d.com
>    
>
> 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:4D_Tech-Unsubscribe@...
> **********************************************************************
     
_________________________________________________________________
Bing brings you maps, menus, and reviews organized in one place.
http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com


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:4D_Tech-Unsubscribe@...
**********************************************************************

Parent Message unknown Re: Implicit Typing would be nice to have

by George Tiller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/4/09 5:53 AM, lists@... wrote:

>On 4 Nov 2009, at 04:10, George Tiller wrote:
>
>> It would sure be nice if we had a command like this:
>>
>> C_REAL("r@")
>
>
>I think 4D decided that if your a fortran programmer, you won't be  
>needing variable names longer than 1 letter anyway and so haven't  
>implemented this feature :)
>
>For more info see http://www.pbm.com/~lindahl/real.programmers.html

Great article, and very funny, but also very true! I was a Fortran
programmer back then, but I was not a Real Programmer in that sense.
After years of struggling with code that had been written by Real
Programmers for the Federal Highway Administration, where I worked, I
took some seminars and courses offered by Yourdon, Trish Sarson, and Tom
McCabe on structured programming and software engineering, and found out
why I had been struggling. In the late '70s, some of us were able to get
the standard boilerplate on software development contracts modified to
require the use of more modern programming techniques. It was interesting
to see which contractors stepped up and adopted the improved standards
and which ones did not. For a few years, some major contracts went to
firms who could demonstrate that they understood the improved programming
practices.



George Tiller
911 East A Street
Brunswick, Maryland 21716


**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Parent Message unknown RE: Implicit Typing would be nice to have

by George Tiller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That macro would certainly be a help in many situations, thanks Garri.


On 11/4/09 5:59 AM, garri_ogata@... wrote:

>At the summit, Miyako demoed a macro that would run thru a method and type
>the variables for you.  I believe his variables were denoted by the _Type
>naming convention but the macro could be changed if some other naming
>convention was used.  It isn't what you are asking but it can help for
>typing variables in a method which is the result you want.
>
>> Date: Tue, 3 Nov 2009 22:10:16 -0500
>> From: gtiller_erols@...
>> To: 4D_Tech@...
>> CC:
>> Subject: Implicit Typing would be nice to have
>>
>> It would sure be nice if we had a command like this:
>>
>> C_REAL("r@")
>>
>> and
>>
>> C_TEXT("@_t")
>>
>> which would implicitly type all variables whose names began with, or that
>> ended with a particular string.
>>
>> 30+ years ago, I could easily do this in Fortran:
>>
>> IMPLICIT INTEGER (i,j,k)



George Tiller
911 East A Street
Brunswick, Maryland 21716


**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Implicit Typing would be nice to have

by Owen Watson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think I uploaded a macro some time ago to this list that typed vars.
However, it relied on QFree, so would have to be slightly rewritten
for the available regex implementations (assuming you're talking about
v11).

2009/11/5 George Tiller <gtiller_erols@...>:

> That macro would certainly be a help in many situations, thanks Garri.
>
>
> On 11/4/09 5:59 AM, garri_ogata@... wrote:
>
>>At the summit, Miyako demoed a macro that would run thru a method and type
>>the variables for you.  I believe his variables were denoted by the _Type
>>naming convention but the macro could be changed if some other naming
>>convention was used.  It isn't what you are asking but it can help for
>>typing variables in a method which is the result you want.
>>
>>> Date: Tue, 3 Nov 2009 22:10:16 -0500
>>> From: gtiller_erols@...
>>> To: 4D_Tech@...
>>> CC:
>>> Subject: Implicit Typing would be nice to have
>>>
>>> It would sure be nice if we had a command like this:
>>>
>>> C_REAL("r@")
>>>
>>> and
>>>
>>> C_TEXT("@_t")
>>>
>>> which would implicitly type all variables whose names began with, or that
>>> ended with a particular string.
>>>
>>> 30+ years ago, I could easily do this in Fortran:
>>>
>>> IMPLICIT INTEGER (i,j,k)
>
>
>
> George Tiller
> 911 East A Street
> Brunswick, Maryland 21716
>
>
> **********************************************************************
> Get the speed and power of 4D v11 SQL
> before upgrade prices increase - http://www.4d.com
>
>
> 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:4D_Tech-Unsubscribe@...
> **********************************************************************
>



--
Owen Watson
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com


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:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Implicit Typing would be nice to have

by Sujit Shah :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Whats wrong with the compiler directive "Type the variables" ?


--
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"The butterfly does not count years, but moments, and therefore has
enough time." - Rabindranath Tagore
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Parent Message unknown Re: Implicit Typing would be nice to have

by George Tiller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/4/09 7:00 PM, sujit.au@... wrote:

>Whats wrong with the compiler directive "Type the variables" ?
>
This is a fine directive, but it types the variables according to their
use, and the program I'm working on uses the same variable in multiple
ways:

v327:=v123+v219+...

and then v327 is displayed on a form.

Since the program has always been running interpreted, 4D helpfully
coerces the variable into changing types when needed. Now it needs to be
compiled, and many, many programming errors need to be fixed.

I want to change the name of the variable to something more meaningful in
4D Insider, and then assign the variable type using a command and have
the compiler flag all the places where the assigned type is violated by
the use of the var, so I can find them and change the variable name to
something different in those cases and have the Compiler assign a
variable type using my set of typing rules. The easiest way is to have
the compiler type the vars correctly is to be able to assign some rules
that will preserve the correct typing, such as:

..._r for REAL
..._d for DATE
..._t for TEXT, etc.

Then, any use of the var that violates the imposed typing will generate
an error so that I can fix the code.

This would be easier than looking at every place that the variable occurs
in code or on a form. With just a few vars, this would be no problem, but
I'm up against thousands of vars with names like v345, vBug744, vPace660,
etc.



George Tiller
911 East A Street
Brunswick, Maryland 21716


**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Parent Message unknown Re: Implicit Typing would be nice to have

by George Tiller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to clarify my example, see below...


On 11/4/09 8:44 PM, gtiller_erols@... wrote:

>On 11/4/09 7:00 PM, sujit.au@... wrote:
>
>>Whats wrong with the compiler directive "Type the variables" ?
>>
>This is a fine directive, but it types the variables according to their
>use, and the program I'm working on uses the same variable in multiple
>ways:
>
>v327:=v123+v219+...

============================
The line above should be more like:

v327:=v123+(v219*.0063)/v752
============================

>
>and then v327 is displayed on a form.
>
>Since the program has always been running interpreted, 4D helpfully
>coerces the variable into changing types when needed. Now it needs to be
>compiled, and many, many programming errors need to be fixed.
>
>I want to change the name of the variable to something more meaningful in
>4D Insider, and then assign the variable type using a command and have
>the compiler flag all the places where the assigned type is violated by
>the use of the var, so I can find them and change the variable name to
>something different in those cases and have the Compiler assign a
>variable type using my set of typing rules. The easiest way is to have
>the compiler type the vars correctly is to be able to assign some rules
>that will preserve the correct typing, such as:
>
>..._r for REAL
>..._d for DATE
>..._t for TEXT, etc.
>
>Then, any use of the var that violates the imposed typing will generate
>an error so that I can fix the code.
>
>This would be easier than looking at every place that the variable occurs
>in code or on a form. With just a few vars, this would be no problem, but
>I'm up against thousands of vars with names like v345, vBug744, vPace660,
>etc.
>


George Tiller
911 East A Street
Brunswick, Maryland 21716


**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Implicit Typing would be nice to have

by David Dancy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How about this:

1. Rename variables in Insider to suit your new conventions.
2. Compile, and have the compiler export the symbol table.
3. Copy/paste the variables portion of the .SYM file into a 4D
COMPILER_Variables method
4. Edit types as appropriate in the COMPILER_Variables method.
5. Compile again. This will flag up lots of errors.
6. Edit the program to make the errors go away.
7. If there are no more variables generating errors and/or to be
renamed, you're done. Otherwise, go to step 1.

Would that work?

David Dancy
Sydney, Australia



2009/11/5 George Tiller <gtiller_erols@...>:

> On 11/4/09 7:00 PM, sujit.au@... wrote:
>
>>Whats wrong with the compiler directive "Type the variables" ?
>>
> This is a fine directive, but it types the variables according to their
> use, and the program I'm working on uses the same variable in multiple
> ways:
>
> v327:=v123+v219+...
>
> and then v327 is displayed on a form.
>
> Since the program has always been running interpreted, 4D helpfully
> coerces the variable into changing types when needed. Now it needs to be
> compiled, and many, many programming errors need to be fixed.
>
> I want to change the name of the variable to something more meaningful in
> 4D Insider, and then assign the variable type using a command and have
> the compiler flag all the places where the assigned type is violated by
> the use of the var, so I can find them and change the variable name to
> something different in those cases and have the Compiler assign a
> variable type using my set of typing rules. The easiest way is to have
> the compiler type the vars correctly is to be able to assign some rules
> that will preserve the correct typing, such as:
>
> ..._r for REAL
> ..._d for DATE
> ..._t for TEXT, etc.
>
> Then, any use of the var that violates the imposed typing will generate
> an error so that I can fix the code.
>
> This would be easier than looking at every place that the variable occurs
> in code or on a form. With just a few vars, this would be no problem, but
> I'm up against thousands of vars with names like v345, vBug744, vPace660,
> etc.
>
>
>
> George Tiller
> 911 East A Street
> Brunswick, Maryland 21716
>
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Parent Message unknown Re: Implicit Typing would be nice to have

by George Tiller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, it would work, and it's a very good idea, thanks!

There is the small problem that step 4 would be more work than being able
to type all of the vars with a few "implicit" compiler directives, but,
not having the "ideal," this is exactly what I'll do. Maybe in v1x, 4D
will give us the implicit typing ala Fortran.

Thanks again David!


On 11/4/09 9:35 PM, david.dancy@... wrote:

>How about this:
>
>1. Rename variables in Insider to suit your new conventions.
>2. Compile, and have the compiler export the symbol table.
>3. Copy/paste the variables portion of the .SYM file into a 4D
>COMPILER_Variables method
>4. Edit types as appropriate in the COMPILER_Variables method.
>5. Compile again. This will flag up lots of errors.
>6. Edit the program to make the errors go away.
>7. If there are no more variables generating errors and/or to be
>renamed, you're done. Otherwise, go to step 1.
>
>Would that work?
>
>
>
>2009/11/5 George Tiller <gtiller_erols@...>:
>> On 11/4/09 7:00 PM, sujit.au@... wrote:
>>
>>>Whats wrong with the compiler directive "Type the variables" ?
>>>
>> This is a fine directive, but it types the variables according to their
>> use, and the program I'm working on uses the same variable in multiple
>> ways:
>>
>> v327:=v123+v219+...
>>
>> and then v327 is displayed on a form.
>>
>> Since the program has always been running interpreted, 4D helpfully
>> coerces the variable into changing types when needed. Now it needs to be
>> compiled, and many, many programming errors need to be fixed.
>>
>> I want to change the name of the variable to something more meaningful in
>> 4D Insider, and then assign the variable type using a command and have
>> the compiler flag all the places where the assigned type is violated by
>> the use of the var, so I can find them and change the variable name to
>> something different in those cases and have the Compiler assign a
>> variable type using my set of typing rules. The easiest way is to have
>> the compiler type the vars correctly is to be able to assign some rules
>> that will preserve the correct typing, such as:
>>
>> ..._r for REAL
>> ..._d for DATE
>> ..._t for TEXT, etc.
>>
>> Then, any use of the var that violates the imposed typing will generate
>> an error so that I can fix the code.
>>
>> This would be easier than looking at every place that the variable occurs
>> in code or on a form. With just a few vars, this would be no problem, but
>> I'm up against thousands of vars with names like v345, vBug744, vPace660,
>> etc.
>>



George Tiller
911 East A Street
Brunswick, Maryland 21716


**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Implicit Typing would be nice to have

by David Dancy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cool. We have had to do some stuff like that in the past and the
symbol table file is pretty handy.

David Dancy
Sydney, Australia



2009/11/5 George Tiller <gtiller_erols@...>:
> Yes, it would work, and it's a very good idea, thanks!
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

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:4D_Tech-Unsubscribe@...
**********************************************************************