discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Style questions

RW
Rogier Wolff
Fri, Aug 19, 2022 3:36 PM

On Fri, Aug 19, 2022 at 02:11:11PM +0100, Roger Whiteley via Discuss wrote:

But I learnt to touch type in 1984 [honest, it really was 1984, me, a
friend, and about 20 others, on real typewriters].

Ha! Beat you by a few years... I learned to touch-type in 1978/79 or
thereabouts.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Fri, Aug 19, 2022 at 02:11:11PM +0100, Roger Whiteley via Discuss wrote: > But I learnt to touch type in 1984 [honest, it really was 1984, me, a > friend, and about 20 others, on real typewriters]. Ha! Beat you by a few years... I learned to touch-type in 1978/79 or thereabouts. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
NH
nop head
Fri, Aug 19, 2022 5:10 PM

I have never been able to touch type and as I get older (60), I seem to get
more dyslexic and nothing I type comes out as intended, so I keep all my
identifiers short and use underscores and don't type anything more than I
have to. However, that is just personal taste. If I was using somebody
else's code I don't mind what convention they use. Especially if they were
blind. I can't imagine how difficult it would be designing 3D objects
without sight. Hats off to the OP.

On Fri, 19 Aug 2022 at 16:38, Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

On Fri, Aug 19, 2022 at 02:11:11PM +0100, Roger Whiteley via Discuss wrote:

But I learnt to touch type in 1984 [honest, it really was 1984, me, a
friend, and about 20 others, on real typewriters].

Ha! Beat you by a few years... I learned to touch-type in 1978/79 or
thereabouts.

     Roger.

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I have never been able to touch type and as I get older (60), I seem to get more dyslexic and nothing I type comes out as intended, so I keep all my identifiers short and use underscores and don't type anything more than I have to. However, that is just personal taste. If I was using somebody else's code I don't mind what convention they use. Especially if they were blind. I can't imagine how difficult it would be designing 3D objects without sight. Hats off to the OP. On Fri, 19 Aug 2022 at 16:38, Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > On Fri, Aug 19, 2022 at 02:11:11PM +0100, Roger Whiteley via Discuss wrote: > > But I learnt to touch type in 1984 [honest, it really was 1984, me, a > > friend, and about 20 others, on real typewriters]. > > Ha! Beat you by a few years... I learned to touch-type in 1978/79 or > thereabouts. > > Roger. > > -- > ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 > ** > ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** > f equals m times a. When your f is steady, and your m is going down > your a is going up. -- Chris Hadfield about flying up the space shuttle. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Fri, Aug 19, 2022 5:19 PM

On 8/19/2022 8:36 AM, Rogier Wolff wrote:

Ha! Beat you by a few years... I learned to touch-type in 1978/79 or
thereabouts.

Circa 1974 for me.  On a Teletype 33 KSR.

But despite a couple of attempts I have never learned to touch-type
properly.  I know where all of the alphabet and most of the
punctuation are, and touch-type them, but I use the wrong fingers.  For
instance, I think I almost always use the left shift key.

On 8/19/2022 8:36 AM, Rogier Wolff wrote: > Ha! Beat you by a few years... I learned to touch-type in 1978/79 or > thereabouts. Circa 1974 for me.  On a Teletype 33 KSR. But despite a couple of attempts I have never learned to touch-type *properly*.  I know where all of the alphabet and most of the punctuation are, and touch-type them, but I use the wrong fingers.  For instance, I think I almost always use the left shift key.
MD
Michele Denber
Fri, Aug 19, 2022 6:33 PM

On 8/19/2022 1:19 PM, Jordan Brown wrote:

Circa 1974 for me.  On a Teletype 33 KSR.

But despite a couple of attempts I have never learned to touch-type
properly.  I know where all of the alphabet and most of the
punctuation are, and touch-type them, but I use the wrong fingers. 
For instance, I think I almost always use the left shift key.

Ha - same here.  I'm so glad to hear I'm not the only one.

            - Michele

On 8/19/2022 1:19 PM, Jordan Brown wrote: > > Circa 1974 for me.  On a Teletype 33 KSR. > > But despite a couple of attempts I have never learned to touch-type > *properly*.  I know where all of the alphabet and most of the > punctuation are, and touch-type them, but I use the wrong fingers.  > For instance, I think I almost always use the left shift key. Ha - same here.  I'm so glad to hear I'm not the only one.             - Michele
FH
Father Horton
Fri, Aug 19, 2022 7:09 PM

There's a right shift key? Who knew?

On Fri, Aug 19, 2022 at 1:34 PM Michele Denber mdenber@gmx.com wrote:

On 8/19/2022 1:19 PM, Jordan Brown wrote:

Circa 1974 for me.  On a Teletype 33 KSR.

But despite a couple of attempts I have never learned to touch-type
properly.  I know where all of the alphabet and most of the
punctuation are, and touch-type them, but I use the wrong fingers.
For instance, I think I almost always use the left shift key.

Ha - same here.  I'm so glad to hear I'm not the only one.

          - Michele

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

There's a right shift key? Who knew? On Fri, Aug 19, 2022 at 1:34 PM Michele Denber <mdenber@gmx.com> wrote: > On 8/19/2022 1:19 PM, Jordan Brown wrote: > > > > Circa 1974 for me. On a Teletype 33 KSR. > > > > But despite a couple of attempts I have never learned to touch-type > > *properly*. I know where all of the alphabet and most of the > > punctuation are, and touch-type them, but I use the wrong fingers. > > For instance, I think I almost always use the left shift key. > Ha - same here. I'm so glad to hear I'm not the only one. > > - Michele > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
L
larry
Fri, Aug 19, 2022 8:04 PM

On Fri, 2022-08-19 at 14:09 -0500, Father Horton wrote:

There's a right shift key? Who knew?

If I were to lose 8 of my 10 fingers, I would not lose any typing
speed.

I got into the computer business in 1966, but never did learn to touch-
type.

On Fri, 2022-08-19 at 14:09 -0500, Father Horton wrote: > There's a right shift key? Who knew? If I were to lose 8 of my 10 fingers, I would not lose any typing speed. I got into the computer business in 1966, but never did learn to touch- type.
AM
Adrian Mariano
Sun, Aug 21, 2022 7:49 PM

I personally hate tabs.

I think that this discussion overlooks a major formatting question for
OpenSCAD code, though it's one that only arises when doing complicated
functions.  The question is, how should conditionals be formatted?

I generally do something like:

x = condition1 ? result1
: condition2 ? result2
: condition3 ? result3
: final result,

But things get more difficult to lay out when the results (or conditions)
are long.

x = condition1 ?
let(
y = something,
z = something_else,
w = f(x,y)
)
result1(y,z,w)
: condition2 ?
etc etc

Another option might be

x = very_long_condition(this,that,the,other)
? result1
: result2,

On Sat, Aug 20, 2022 at 9:26 AM larry lar3ry@sasktel.net wrote:

On Fri, 2022-08-19 at 14:09 -0500, Father Horton wrote:

There's a right shift key? Who knew?

If I were to lose 8 of my 10 fingers, I would not lose any typing
speed.

I got into the computer business in 1966, but never did learn to touch-
type.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I personally hate tabs. I think that this discussion overlooks a major formatting question for OpenSCAD code, though it's one that only arises when doing complicated functions. The question is, how should conditionals be formatted? I generally do something like: x = condition1 ? result1 : condition2 ? result2 : condition3 ? result3 : final result, But things get more difficult to lay out when the results (or conditions) are long. x = condition1 ? let( y = something, z = something_else, w = f(x,y) ) result1(y,z,w) : condition2 ? etc etc Another option might be x = very_long_condition(this,that,the,other) ? result1 : result2, On Sat, Aug 20, 2022 at 9:26 AM larry <lar3ry@sasktel.net> wrote: > On Fri, 2022-08-19 at 14:09 -0500, Father Horton wrote: > > There's a right shift key? Who knew? > > If I were to lose 8 of my 10 fingers, I would not lose any typing > speed. > > I got into the computer business in 1966, but never did learn to touch- > type. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Sun, Aug 21, 2022 8:24 PM

On 8/21/2022 12:49 PM, Adrian Mariano wrote:

I personally hate tabs. 

Next question, then:  fixed indentation steps, or some kind of variable
scheme?

I think that this discussion overlooks a major formatting question for
OpenSCAD code, though it's one that only arises when doing complicated
functions.  The question is, how should conditionals be formatted? 

I can't say that I have a mature plan here, but I have some guidelines.

If it's short then one line is OK.  "Short" is approximately no more
than a two-term expression in each of the three slots.  And if they're
all two-term expressions, it's not short.

If it's not short, then I prefer

x = a
    ? b
    : c;

so that the if-true value and the if-false value are peers, with the ?
or : marking them.

If b is itself a ?: sequence, then parenthesize and indent it, probably:

x = a
    ? (b
        ? d
        : e
    )
    : c;

But also consider extracting it out into a separate function.

If c is a ?: sequence, continue at the same level of indentation:

x = a
    ? b
    : c
    ? d
    : e;
On 8/21/2022 12:49 PM, Adrian Mariano wrote: > I personally hate tabs.  Next question, then:  fixed indentation steps, or some kind of variable scheme? > I think that this discussion overlooks a major formatting question for > OpenSCAD code, though it's one that only arises when doing complicated > functions.  The question is, how should conditionals be formatted?  I can't say that I have a mature plan here, but I have some guidelines. If it's short then one line is OK.  "Short" is approximately no more than a two-term expression in each of the three slots.  And if they're all two-term expressions, it's not short. If it's not short, then I prefer x = a     ? b     : c; so that the if-true value and the if-false value are peers, with the ? or : marking them. If b is itself a ?: sequence, then parenthesize and indent it, probably: x = a     ? (b ? d : e )     : c; But also consider extracting it out into a separate function. If c is a ?: sequence, continue at the same level of indentation: x = a     ? b     : c ? d : e;
BC
Bob Carlson
Sun, Aug 21, 2022 11:19 PM

I went and grabbed one of mine. It’s pretty close to what you’ve got below.

function _gap_adjustment(si) =
let (
pos = _pos_n(_Pos(si)),
gap = _Gap(si),
headLen = _HeadH(si) + _ClearH(si),
nutLen = _ScrewL(si) - gap + _ClearS(si)
)

(pos <= 0) ? 0 : 
(pos == 1) ? headLen :
(pos == 2) ? headLen + gap/2 :
(pos == 3) ? headLen + gap :
(pos == 4) ? headLen + _ScrewL(si):
             headLen + gap + nutLen;

-Bob
Tucson AZ

On Aug 21, 2022, at 12:49, Adrian Mariano avm4@cornell.edu wrote:

I personally hate tabs.

I think that this discussion overlooks a major formatting question for OpenSCAD code, though it's one that only arises when doing complicated functions.  The question is, how should conditionals be formatted?

I generally do something like:

x = condition1 ? result1
: condition2 ? result2
: condition3 ? result3
: final result,

But things get more difficult to lay out when the results (or conditions) are long.

x = condition1 ?
let(
y = something,
z = something_else,
w = f(x,y)
)
result1(y,z,w)
: condition2 ?
etc etc

Another option might be

x = very_long_condition(this,that,the,other)
? result1
: result2,

On Sat, Aug 20, 2022 at 9:26 AM larry <lar3ry@sasktel.net mailto:lar3ry@sasktel.net> wrote:
On Fri, 2022-08-19 at 14:09 -0500, Father Horton wrote:

There's a right shift key? Who knew?

If I were to lose 8 of my 10 fingers, I would not lose any typing
speed.

I got into the computer business in 1966, but never did learn to touch-
type.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I went and grabbed one of mine. It’s pretty close to what you’ve got below. function _gap_adjustment(si) = let ( pos = _pos_n(_Pos(si)), gap = _Gap(si), headLen = _HeadH(si) + _ClearH(si), nutLen = _ScrewL(si) - gap + _ClearS(si) ) (pos <= 0) ? 0 : (pos == 1) ? headLen : (pos == 2) ? headLen + gap/2 : (pos == 3) ? headLen + gap : (pos == 4) ? headLen + _ScrewL(si): headLen + gap + nutLen; -Bob Tucson AZ On Aug 21, 2022, at 12:49, Adrian Mariano <avm4@cornell.edu> wrote: I personally hate tabs. I think that this discussion overlooks a major formatting question for OpenSCAD code, though it's one that only arises when doing complicated functions. The question is, how should conditionals be formatted? I generally do something like: x = condition1 ? result1 : condition2 ? result2 : condition3 ? result3 : final result, But things get more difficult to lay out when the results (or conditions) are long. x = condition1 ? let( y = something, z = something_else, w = f(x,y) ) result1(y,z,w) : condition2 ? etc etc Another option might be x = very_long_condition(this,that,the,other) ? result1 : result2, On Sat, Aug 20, 2022 at 9:26 AM larry <lar3ry@sasktel.net <mailto:lar3ry@sasktel.net>> wrote: On Fri, 2022-08-19 at 14:09 -0500, Father Horton wrote: > There's a right shift key? Who knew? If I were to lose 8 of my 10 fingers, I would not lose any typing speed. I got into the computer business in 1966, but never did learn to touch- type. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org