Custom comments: Lots of tips, more wanted!

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

Custom comments: Lots of tips, more wanted!

4D Tech mailing list
I'm looking at custom constants again and have put together some thoughts.
I wanted to post them here for the sake of the archives, and to solicit
expansions, corrections, tips and the like. If you've got anything to add,
please contribute!

Here goes:

* Right now, not that many people are using thread-safe processes in V16,
but that will change. One of the limits of preemptive mode is that you
cannot use IP variables. For a lot of existing 4D systems, IP variables
have been used instead of custom constants. So, going forward, making
custom constants easier to love is a Very Good Thing.

* Custom constants are great, but they can be a bit of a pain...so they
aren't used as universally as they could be. (Should be?)

* One of the pains is that you have to reopen the database to see custom
constant modifications. *This makes sense.* Constants are values that
cannot change at runtime, so 4D loads them once at startup before our code.
*But this is a pain.* If you agree, please vote in favor of this feature
request:

  Please add a 'Reload constants' command
  http://forums.4d.fr/Post/EN/19514761/1/19514762

* 4D supports custom constants of the simple types Longint, Real, and
String.

* Boolean would be a big help, please vote in favor of this idea here:

  Please add support for custom constants of type Boolean
  http://forums.4d.fr/Post/EN/19514786/1/19514787

* Constants are better than static variables because no lookup,
initialization, etc. needs to be done. The value is set once and that's it.
In a compiled application, the value of the constant is baked right into
the code. So, you can throw away a constants file from a deployed component
or application.

* Duplicate constants are a Very Bad Thing. With that in mind:
-- Remove constants from compiled components. Helpful.
-- Consider a naming starting constants like K_ or your initials, a module
prefix, or a program-specific prefix.


* 4D Pop works fine, but then the constants definition is not in your code.
Alternatively, Jim Dorrance has posted some constants management code here
and Cannon Smith includes custom constants code in some of his (free)
modules. I'm using Cannon's code at the moment and it has made my life a
*lot* better. No criticism of 4D Pop (none! I'm grateful), but I find it
easier (a lot easier) to have everything in the code.

* Sigh. Constant names/labels are limited to 31 characters. Why? No idea.
If you agree that this limit is too low, please vote in favor of this
request:

Raise the 31 character name limit on methods
http://forums.4d.fr/Post/EN/18946884/1/18946885

It's on 4 stars with 56 votes. Four more and it hits 60 votes!

P.S. If you don't think 31 characters is too low a limit for names, you are
a monster. Just saying.


What have I missed? Been misleading about? Been wrong about? Please post
tips, corrections, suggestions, etc.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
Forgot to say:

* Constants for numeric codes are great as they make the code a whole lot
easier to read:

$error_level:=5

Well that's good to know...I guess. Is that good or bad? With a custom
consant:

$error_level:=Error level is fatal

Oh, that makes more sense.

* Constants for strings as they make @$%@#$%@#% stupid errors from typos a
thing of the past, well, at least where they use them. This is super
helpful when working with property names in C_OBJECT. (Really what we need
are definable schemas for C_OBJECT contents that the compiler checks -
custom types - but that's a whole different discussion.)

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
David,


On Sat, Jun 3, 2017 at 10:30 PM, David Adams via 4D_Tech <
[hidden email]> wrote:
>
> * Constants for strings as they make @$%@#$%@#% stupid errors from typos a
> thing of the past, well, at least where they use them. This is super
> helpful when working with property names in C_OBJECT. (Really what we need
> are definable schemas for C_OBJECT contents that the compiler checks -
> custom types - but that's a whole different discussion.)
> ​
>
​Agree. ​
​Since I've been using c-obj more and more for parameter passing and just
general data handling in memory I've started using constants more than
before for object keys exactly because of the need for keys to be exact.
With constants the key label can be more semantic (ie: module specific
thingy name) even when the actual key is more generic (ie: "name").

And you suggestion for being able to re-load constants is good.

You know what else would be good is if constants weren't stored in
Resources but in a separate Constants folder. Why? Because they don't need
to ship with the db if it's compiled and it's a pain to remember to remove
them after building the compiled app.

And ultimately it would be preferable for them to be integral to 4D rather
than as an add on. ​

--
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
On Sun, Jun 4, 2017 at 2:40 PM, Kirk Brooks via 4D_Tech <
[hidden email]> wrote:


> ​Since I've been using c-obj more and more for parameter passing and just
> general data handling in memory I've started using constants more than
> before for object keys exactly because of the need for keys to be exact.
> With constants the key label can be more semantic (ie: module specific
> thingy name) even when the actual key is more generic (ie: "name").
>

You've been mentioning this for some time and I eventually came around to
your point of view. 100% agreed.


> And you suggestion for being able to re-load constants is good.
>

I'm not sure what it entails on a technical level for 4D but, hopefully,
it's an easy one.


> You know what else would be good is if constants weren't stored in
> Resources but in a separate Constants folder. Why? Because they don't need
> to ship with the db if it's compiled and it's a pain to remember to remove
> them after building the compiled app.
>

Huh, interesting idea. Do you mid submitting that as a feature request and
see what we get back? I think what I'd ask for is along the lines of a
build option "Delete constants from built application/component". Something
like that. What do you think? Either way, please put in a feature request
for what you like and post a notice here so that those of us interested in
the subject can vote.


> And ultimately it would be preferable for them to be integral to 4D rather
> than as an add on. ​
>

Agreed. I've thought so since custom constants were first available in 4D
6.5. Holding breath.....I think that would mean storing them in the
struture, which has some downsides and doesn't seem to be the way 4D is
heading. I'm not sure how best they could integrate them natively in
design, but it sure would be nicer. Maybe some kind of define statement?

Define(Theme;Label;Value) // Value can be Long, String, Real, or Boolean

Define("Error Constants";"Error level is informational";1)
Define("Error Constants";"Error level is warning";2)
Define("Error Constants";"Error level is error";3)
Define("Error Constants";"Error level is critical";4)
Define("Error Constants";"Error level is fatal";5)

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
David,

I have been a fan of custom constants since I started using 4D, probably because my background in C meant that I couldn’t imagine a programming environment which didn’t have them (whether as preprocessor directives or enumerations).

I think some of your suggestions are wonderful. RELOAD CONSTANTS would be great to have while developing. But a couple puzzle me.

Boolean constants: why? What more than True and False do you need?

Removing constants from compiled / distribution code. For completed databases, yes. For components, no: I use constants exported from components as a way of communicating with them, as selectors or parameters. I remember being bewildered when I started using 4D that the 4D Chart didn’t using constants for the huge array of selectors passed to its routines, but needed me to remember numeric selectors.

But I must confess to being a monster, sadly.

Jeremy


Jeremy Roussak
[hidden email]

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
#define informational 1
#define warning 2


Hmm. I think I’ve seen that somewhere before.


Jeremy Roussak
[hidden email]



> On 4 Jun 2017, at 06:40, David Adams via 4D_Tech <[hidden email]> wrote:
>
>
> Define(Theme;Label;Value) // Value can be Long, String, Real, or Boolean
>
> Define("Error Constants";"Error level is informational";1)
> Define("Error Constants";"Error level is warning";2)
> Define("Error Constants";"Error level is error";3)
> Define("Error Constants";"Error level is critical";4)
> Define("Error Constants";"Error level is fatal";5)
>
> Thoughts?

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
> I have been a fan of custom constants since I started using 4D, probably
because
> my background in C meant that I couldn’t imagine a programming
environment which
> didn’t have them (whether as preprocessor directives or enumerations).

How have you coped with no enumerated types and no structs? I regularly
feel the urge to resort to self-harm because 4D has no structs and I never
used C. I mean, structs (and similar) a language feature from the
1970s...not exactly some fancy modern novelty.

>Boolean constants: why? What more than True and False do you need?

Now there is an entirely fair question which I failed to answer well in my
feature request. Happily, Miyako answered it well:

I think what you are after is more like

MyMethod (with_this_option;without_that_option)

instead of

MyMethod (True;False)

Yes. Lables that mean true or false - I would use them a lot. Here's an
example:

Method_DoThingsAndStuff (True) // Eh?
Method_DoThingsAndStuff (Open file) // That's better.

> Removing constants from compiled / distribution code. For completed
databases, yes. For components, no: I use constants
> exported from components as a way of communicating with them, as
selectors or parameters.

Good point. Yeah, better that this is an option. I'm still getting used to
4D's components and haven't thought everything through. Sometimes, I want
exacty what you describe, other times what I want is to make sure that
extra constants are tossed to avoid duplication up at the host database
level. Best would be if 4D would check for duplicate constants and notify
us. Righ now, you can stack multiple identical constants into the same
system.

> I remember being bewildered when I started using 4D that the 4D Chart
didn’t using constants for the huge
> array of selectors passed to its routines, but needed me to remember
numeric selectors.
Oh, that's been fixed! They killed 4D Chart ;-) Oddly enough, the new
charting (toy) feature GRAPH supports 8 chart types but they're specified
by numerics without constants. I added my own custom constants for these.

> But I must confess to being a monster, sadly.
You. Monster. I think that a lot of fancy conversations about programming
style boil down to typing speed. I'm probably in the 80-90% in typing speed
and I
loveReallyLongNamesThatCompletelyDescribeWhatAMethodDoesClearlyAndCompletely.
Others don't. I had a boss that typed like a chicken looking for corn. His
names were, well, brief. No philosophy, it was just hard for him to get
anything done because of his limited keyboard skills. There would have been
no problem spreading some philosophy on top of that as an excuse but, well,
it came down to only having a finger on each hand for typing.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Re-loading constants. Run Menu, Restart Interpreted: Alt Command I.

Faster than finding a command and executing it.
--
Jim Dorrance
[hidden email]
[hidden email]
www.4d.dorrance.eu

PS: If you know of anyone that needs an experienced 4D programmer to add
energy and experience to their team, please let me know. I have
experience in many areas. Reasonable rates. Remote or Paris only.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list

> Le 4 juin 2017 à 12:04, Jim Dorrance via 4D_Tech <[hidden email]> a écrit :
>
> Re-loading constants. Run Menu, Restart Interpreted: Alt Command I.
>
> Faster than finding a command and executing it.

Nice!
First time I realize its not only a toggle compiled/interpreted  :-(

--
Arnaud de Montard




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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
David,

On Sat, Jun 3, 2017 at 11:40 PM, David Adams via 4D_Tech <
[hidden email]> wrote:

> On Sun, Jun 4, 2017 at 2:40 PM, Kirk Brooks via 4D_Tech <
> [hidden email]> wrote:
> > You know what else would be good is if constants weren't stored in
> > Resources but in a separate Constants folder. Why? Because they don't
> need
> > to ship with the db if it's compiled and it's a pain to remember to
> remove
> > them after building the compiled app.
> >
>
> Huh, interesting idea. Do you mid submitting that as a feature request and
> see what we get back?

http://forums.4d.fr/Post//19516139/1/

​I bet the option on the build routine is easier and would be perfectly
acceptable for me. ​

> And ultimately it would be preferable for them to be integral to 4D rather
> > than as an add on. ​
> >
>
> Agreed. I've thought so since custom constants were first available in 4D
> 6.5. Holding breath.....I think that would mean storing them in the
> struture, which has some downsides and doesn't seem to be the way 4D is
> heading.

​Good point. Maybe what we need is just a more robust editing option? 4DPOP
isn't bad - but like you say it's a little cumbersome. And having some
tools for surveying multiple files for things like duplicates and
repetitions would be good. ​

I'm not sure how best they could integrate them natively in

> design, but it sure would be nicer. Maybe some kind of define statement?
>
> Define(Theme;Label;Value) // Value can be Long, String, Real, or Boolean
>
> Define("Error Constants";"Error level is informational";1)
> Define("Error Constants";"Error level is warning";2)
> Define("Error Constants";"Error level is error";3)
> Define("Error Constants";"Error level is critical";4)
> Define("Error Constants";"Error level is fatal";5)
>

​I'm going to have to try that and see if it makes things easier for me. I
do like the idea of adding them on the fly. Coupled with an (interpreted
only) RELOAD CONSTANTS command it would greatly ease the headache of adding
constants early rather than later. Typically I sketch out a process (I
still use paper or a whiteboard) and then start roughing it out in 4D. Once
the fundamental actions are working I start filling in more error handling,
options and all the stuff that makes it good for users but more
complicated. Sometimes the constants I'm going to want are apparent early
on but more times than not it's not really solid until deeper in.

The reload thing is a deal on apps with an extensive startup process.

--
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Kirk,

I've been growing my constants list exponentially for this very reason.
Since object attributes are case sensitive, the opportunity for maddening
bugs is high. Attribute name constants eliminate this. I group them with a
prefix for easy typeahead and code clarity ("PREF Save error to log attrib"
with value "pref_save_error_to_log_b") so the value also tells me the
typing of the value.

On Sat, Jun 3, 2017 at 9:40 PM, Kirk Brooks via 4D_Tech <
[hidden email]> wrote:

> David,
>
>
> On Sat, Jun 3, 2017 at 10:30 PM, David Adams via 4D_Tech <
> [hidden email]> wrote:
> >
> > * Constants for strings as they make @$%@#$%@#% stupid errors from typos
> a
> > thing of the past, well, at least where they use them. This is super
> > helpful when working with property names in C_OBJECT. (Really what we
> need
> > are definable schemas for C_OBJECT contents that the compiler checks -
> > custom types - but that's a whole different discussion.)
> > ​
> >
> ​Agree. ​
> ​Since I've been using c-obj more and more for parameter passing and just
> general data handling in memory I've started using constants more than
> before for object keys exactly because of the need for keys to be exact.
> With constants the key label can be more semantic (ie: module specific
> thingy name) even when the actual key is more generic (ie: "name").
>
> And you suggestion for being able to re-load constants is good.
>
> You know what else would be good is if constants weren't stored in
> Resources but in a separate Constants folder. Why? Because they don't need
> to ship with the db if it's compiled and it's a pain to remember to remove
> them after building the compiled app.
>
> And ultimately it would be preferable for them to be integral to 4D rather
> than as an add on. ​
>
> --
> Kirk Brooks
> San Francisco, CA
> =======================
>
> *The only thing necessary for the triumph of evil is for good men to do
> nothing.*
>
> *- Edmund Burke*
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************
>



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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
> On Sun, Jun 4, 2017 at 2:40 PM, Kirk Brooks via 4D_Tech <

The reload thing is a deal on apps with an extensive startup process.



> Constants are meant to be used. If you do not re-initialise everything,
> you might have code built with previous constant values.
>
>
>
> --
Jim Dorrance
[hidden email]
[hidden email]
www.4d.dorrance.eu

PS: If you know of anyone that needs an experienced 4D programmer to add
energy and experience to their team, please let me know. I have
experience in many areas. Reasonable rates. Remote or Paris only.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
On Mon, Jun 5, 2017 at 4:28 AM, Jim Dorrance via 4D_Tech <
[hidden email]> wrote:

> Constants are meant to be used. If you do not re-initialise everything,
> you might have code built with previous constant values.

In my feature request, I put this down as definitely an 'at your own risk'
feature. With that said, you could run into trouble from modifying
*anything* in Design and not starting again. Forms, methods, etc.
Restarting for constants is a pain and it keeps people from using them.
Getting more people using constants seems like a Very Good Thing. Also,
this feature should only be allowed in interpreted mode. Heck, it could be
a menu item in Design without a command for all I care. Maybe that's
better, actually.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
David,

I’ve missed enumerated types and structs very much, just as I’ve missed such things as pre- and post-increment and decrement, the ?: construct (now addressed by Choose, admittedly), the lack of any true ability to break out of a loop and some of the more interesting and creative uses of #define. I used to use the last to cope with the loss of some of the lovely rich syntax of BCPL. Hey ho: there are some language design decisions which I shall never understand.

Booleans: OK, fair point. Numeric constants would accomplish what you want and look pretty similar, but I accept that boolean constants would be cleaner.

The removal of 4D Chart just to fix the lack of constants (!) was perhaps, as one of my lecturers commented when I was at university, “getting the sledgehammer/nut ratio wrong”. I got round the problem by defining a large number of constants myself, but I vaguely resented the time I had to put into it.

As to variable names, I’m a pretty quick touch typist. I just don’t like long names. I don’t like underscores in names, either (it’s camelCase for me). De gustibus…

Jeremy


Jeremy Roussak
[hidden email]



> On 4 Jun 2017, at 10:35, David Adams via 4D_Tech <[hidden email]> wrote:
>
>> I have been a fan of custom constants since I started using 4D, probably
> because
>> my background in C meant that I couldn’t imagine a programming
> environment which
>> didn’t have them (whether as preprocessor directives or enumerations).
>
> How have you coped with no enumerated types and no structs? I regularly
> feel the urge to resort to self-harm because 4D has no structs and I never
> used C. I mean, structs (and similar) a language feature from the
> 1970s...not exactly some fancy modern novelty.
>
>> Boolean constants: why? What more than True and False do you need?
>
> Now there is an entirely fair question which I failed to answer well in my
> feature request. Happily, Miyako answered it well:
>
> I think what you are after is more like
>
> MyMethod (with_this_option;without_that_option)
>
> instead of
>
> MyMethod (True;False)
>
> Yes. Lables that mean true or false - I would use them a lot. Here's an
> example:
>
> Method_DoThingsAndStuff (True) // Eh?
> Method_DoThingsAndStuff (Open file) // That's better.
>
>> Removing constants from compiled / distribution code. For completed
> databases, yes. For components, no: I use constants
>> exported from components as a way of communicating with them, as
> selectors or parameters.
>
> Good point. Yeah, better that this is an option. I'm still getting used to
> 4D's components and haven't thought everything through. Sometimes, I want
> exacty what you describe, other times what I want is to make sure that
> extra constants are tossed to avoid duplication up at the host database
> level. Best would be if 4D would check for duplicate constants and notify
> us. Righ now, you can stack multiple identical constants into the same
> system.
>
>> I remember being bewildered when I started using 4D that the 4D Chart
> didn’t using constants for the huge
>> array of selectors passed to its routines, but needed me to remember
> numeric selectors.
> Oh, that's been fixed! They killed 4D Chart ;-) Oddly enough, the new
> charting (toy) feature GRAPH supports 8 chart types but they're specified
> by numerics without constants. I added my own custom constants for these.
>
>> But I must confess to being a monster, sadly.
> You. Monster. I think that a lot of fancy conversations about programming
> style boil down to typing speed. I'm probably in the 80-90% in typing speed
> and I
> loveReallyLongNamesThatCompletelyDescribeWhatAMethodDoesClearlyAndCompletely.
> Others don't. I had a boss that typed like a chicken looking for corn. His
> names were, well, brief. No philosophy, it was just hard for him to get
> anything done because of his limited keyboard skills. There would have been
> no problem spreading some philosophy on top of that as an excuse but, well,
> it came down to only having a finger on each hand for typing.
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Not when you have a bunch of Find In Design windows open, several deeply nested Explorer folders expanded, and several non-developer related windows in some state that takes time to reproduce. Relaunching 4D then is a hassle.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236
<[hidden email]>
<www.synergyfarmsolutions.com>


> On Jun 4, 2017, at 4:04 AM, Jim Dorrance via 4D_Tech <[hidden email]> wrote:
>
> Re-loading constants. Run Menu, Restart Interpreted: Alt Command I.
>
> Faster than finding a command and executing it.

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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
In reply to this post by 4D Tech mailing list
> Define(Theme;Label;Value) // Value can be Long, String, Real, or Boolean

BTW, one nice thing about creating constants directly in code, if we had a 4D command to do it, is that it would be easier to give away code. For example, I’ve started to use constants extensively in the last year or two, but I didn’t use any in the OBJ module that a few people use, even though there are a few parameters that really need to be constants. Why? Because it would have made it harder to share the code. Not that adding another constants file to a structure is a big deal, but it is one more thing to deal with.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236
<[hidden email]>
<www.synergyfarmsolutions.com>


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

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
unless and/or until 4D gives us this ability:
- IP vars define at startup - do not change

On Mon, 5 Jun 2017 10:26:25 -0600, Cannon Smith via 4D_Tech wrote:

>> Define(Theme;Label;Value) // Value can be Long, String, Real, or Boolean
>
> BTW, one nice thing about creating constants directly in code, if we
> had a 4D command to do it, is that it would be easier to give away
> code. For example, I’ve started to use constants extensively in the
> last year or two, but I didn’t use any in the OBJ module that a few
> people use, even though there are a few parameters that really need
> to be constants. Why? Because it would have made it harder to share
> the code. Not that adding another constants file to a structure is a
> big deal, but it is one more thing to deal with.
>
> --
> Cannon.Smith
> Synergy Farm Solutions Inc.
> Hill Spring, AB Canada
> 403-626-3236
> <[hidden email]>
> <www.synergyfarmsolutions.com>
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
Hi Chip,

That brings up a good question. A “static” variable doesn’t seem very much different from a constant on the surface. The only differences I can think of are (1) a constant is compiled into the raw binary and (2) because of that, a constant is the same across all instances of an app, where a “static” variable can be computed at launch (or when it is created). It just can’t change later on while the app is running.

But since so many languages have the concept of constants and “static” variables as separate things, it makes me wonder if there are more subtle (and important) differences that I don’t understand. Does anyone who has experience with both know how important it is to have both concepts in a language? Or could they be merged into one idea with no drawbacks?

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236
<[hidden email]>
<www.synergyfarmsolutions.com>


> On Jun 5, 2017, at 10:40 AM, Chip Scheide <[hidden email]> wrote:
>
> unless and/or until 4D gives us this ability:
> - IP vars define at startup - do not change

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

RE: Custom comments: Lots of tips, more wanted!

4D Tech mailing list
> The only differences I can think of are (1) a constant is compiled into the raw binary
> and (2) because of that, a constant is the same across all instances of an app, where
> a “static” variable can be computed at launch (or when it is created). It just can’t change
> later on while the app is running.

These are way different in other languages. C++ for example

A 4D "constant" is more like a compiler definition "#define" where the compiler will substitute a name for a value
        #define MAX_ARRAY_SIZE 20
        // anywhere MAX_ARRAY_SIZE is in the code, the compiler will put in a 20

A constant in C++ is more like a variable that can't be modified, assigned once at declaration and then never changes while in scope. For example
        myMethod (const int myParam)
        const tint myParam = 7;

A Static is more of a shared variable for example a static variable in a class that is shared between instances of a classes with a single initialization, each instance of the class access have access to the same variable

Concepts get more involved when you have static classes :)

Neil




--

Privacy Disclaimer: This message contains confidential information and is intended only for the named addressee. If you are not the named addressee you should not disseminate, distribute or copy this email. Please delete this email from your system and notify the sender immediately by replying to this email.  If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

The Alternative Investments division of UMB Fund Services provides a full range of services to hedge funds, funds of funds and private equity funds.  Any tax advice in this communication is not intended to be used, and cannot be used, by a client or any other person or entity for the purpose of (a) avoiding penalties that may be imposed on any taxpayer or (b) promoting, marketing, or recommending to another party any matter addressed herein.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Loading...