Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Bit Swizzling

12 views
Skip to first unread message

olcott

unread,
Sep 8, 2020, 2:09:57 PM9/8/20
to
On 9/8/2020 12:53 PM, Bonita Montero wrote:
>> Parenthesis makes code more readable because precidence is explicitly
>> stated rather than implied. Complex expressions should be broken down
>> into their constituent parts.
>
> Parentheses make the code less readable if you know the operator
> precedence.
>

If complex expressions are encoded as a hierarchy of appropriately named
compile time macros parenthetical expression nesting is greatly reduced.

I have found that it is best to make code directly say what you mean and
not have to separately remember language details that can possibly vary
across languages.


--
Copyright 2020 Pete Olcott

Bonita Montero

unread,
Sep 8, 2020, 2:44:54 PM9/8/20
to
> If complex expressions are encoded as a hierarchy of appropriately named
> compile time macros parenthetical expression nesting is greatly reduced.

That's a totally different discussion.

Kaz Kylheku

unread,
Sep 8, 2020, 2:48:33 PM9/8/20
to
On 2020-09-08, olcott <No...@NoWhere.com> wrote:
> On 9/8/2020 12:53 PM, Bonita Montero wrote:
>>> Parenthesis makes code more readable because precidence is explicitly
>>> stated rather than implied. Complex expressions should be broken down
>>> into their constituent parts.
>>
>> Parentheses make the code less readable if you know the operator
>> precedence.
>>
>
> If complex expressions are encoded as a hierarchy of appropriately named
> compile time macros parenthetical expression nesting is greatly reduced.

See, if you just avoid topics of Turing and Halting, you start to make sense.

You should do that more often.

You could teach children computing principles or something.

> I have found that it is best to make code directly say what you mean and
> not have to separately remember language details that can possibly vary
> across languages.

That's a great point; I was also thinking of the same thing. Suppose
you're a busy developer working on tasks in four different languages in
the same day. You can get tripped up; your wires can get crossed.

By and large, languages broadly agree on only the "BEDMAS" precedence
rules everyone learns in elementary school. For other operators that
language designers have invented, there is a large variance in
precedences and other details.

(Not all languages, have BEDMAS, either. Smalltalk is an example of a
language in which operators are reduced left to right, because they are
just method application, or something like that: x + y * z means (x +
y) * x).
0 new messages