code generation for the ternary operator

G

Gene Wirchenko

I have been pushing the SCID idea for decades. There has been very
strong resistance to it. I think it is based on the following:

1. I talk about all the wild an crazy things you COULD do with code
display it if were pre-parsed into a tree. Most of these things
remind people of the clownish decor in a McDonald's restaurant. They
imagine garish colours, dancing paperclips, animated icons... And run
in horror. They don't get in that what I am about is CUSTOMISATION,
so you can have the display EXACTLY the way YOU like it, completely
independent of what other people like. None of this would be
mandatory. They look at my prototype JDisplay listings and recoil at
the garishness. http://mindprod.com/jgloss/jdisplay.html

What would it take to implement such? If it is much effort at
all, it gets in the way or is difficult to justify. Writing a
text-processing utility is simpler.
2. People have SCID-like tools that just got in the way of editing.

Yes. I have utilties that process text files. I would like to
be able to use them on source code without having to jump through a
hoop.
3. People like the security of text files. Database have a habit of
losing everything, perhaps with software is discontinued, OSes
changes.

I would say "simplicity" instead of "security", but it is about
the same argument. Text files convert to other systems fairly easily,
too, but SCID between two SCID systems might not.
4. Experienced programmers think of programming as manipulating text.
They have to be weaned to think more of thinking of programming as
more like plumbing where you interconnect names. Eventually editing
will be much more visual where you select methods, drag variables into
place, and do a lot of selecting from a list of what the SCID
considers most plausible.

Typing is much faster than mousing for me. The text interface is
also simpler. I can use my own editor that fits my preferences rather
than getting locked into a GUI IDE.
I have been pitching some of these ideas to IntelliJ. I am using the
notion of almost-subliminal differences in the way text is rendered to
give additional information about each symbol without having to look
back at the definition. Given that you are not supposed to even
notice the difference perhaps contrarians will then argue for more
distinctive warping.

I tend to find such things distracting and prefer to not have
them.

Sincerely,

Gene Wirchenko
 
D

Daniel Pitts

On Tue, 01 Nov 2011 09:41:00 -0700, Daniel Pitts

[snip]
I've often thought about a "new" way of representing code, where the
logical structure is stored in not-necessarily-human-editable format,
but the tools for managing the code allow it to be presented in a format
chosen by the particular maintainer.

One problem is whether you can replicate my way. I like my code
formatted a certain way. If your tool can not do this, I will not
like using it. I will avoid it if at all possible.
Of course. The idea is that the view would be formatted to the
individual contributors taste. Including folding of constructs you don't
want to default visible, and potentially flowchart views or dependency
graphs, etc... With an model that is more than an AST, much is possible.
Other people feel the same way about their formats. Miss very
many possibilities, and you will have bad will from [|potential]
users.

I was wading through the editor settings for Visual Studio and
ended up having to shut off a lot of the formatting, because the
formatting done was not to my taste.

I was just looking through the editor settings for Dreamweaver.
It does not do what I want.<sigh>
This is getting a little off topic, but I would like to say the IntelliJ
IDEA has a very flexible configuration for formatting that can do most
of what you want. At the same time, being personally inflexible in what
style you're willing to work in will limit your ability to work on many
teams. I recently have started working on an open-source project which
has different style than I am used to, or even prefer. Luckily, IntelliJ
IDEA can be set up to switch between styles for different projects.
A loop already can be manipulated easily by a competent
programmer.
A single loop, yes, but aspects (joins and advice) can be more difficult
to navigate. My idea was to make *everything* easier (or no more
difficult) than it already is.
^^^^^^^^^^ ^^^^^
Or it would be a straitjacket.
Some programmers I know should be in a straitjacket :)
I do not understand the captioned words as used. Should "manor"
be "manner"? Yes, consider that a typo :)


How would you deal with the case of syntax errors? I sometimes
have a placeholder. A simple example would be:
i=0;
while (i<SomeValue*****)
{
<various looping statements>
}
The point is that I might not know exactly what the looping condition
has to be. (In this case, I might be wondering if I will need a flag
for early exit.) I want to able to enter a placeholder should I need
it.
I think a good solution to that particular problem is to have an
unimplemented predicate method:
while (thisLoopShouldContinue(i) {...}

@ToImplement boolean thisLoopShouldContinue();

In general, "uncompilable fragments" would probably have to be supported
at some levels. Since the tool would maintain a structured model, the
fragments couldn't accidentally interfere with other parts of the code.
For example, and extra ")" or "}" would be localized to the context it
was entered in.
VB 6 had a switch for compiling each line as entered. I did not
like it and disabled it as part of my configuration. Sometimes, in
mid-line, I would note that I had to change something else. When the
option was enabled, I would move off the line and often get a syntax
error. I knew that. I prefer to be told about compilation errors
when I ask, not to be interrupted by an overeager compiler.

You're talking a lot about old-tech editors. Would you disable
spell-checking on a document editor? Modern IDEs will highlight errors
and warnings, without a lot of fuss. Yes, I sometimes leave a line
half-finished too, and I'm grateful that my IDE will remind me to go
back to that line when I get distracted on something else.
 
M

Martin Gregorie

I would say "simplicity" instead of "security", but it is about
the same argument. Text files convert to other systems fairly easily,
too, but SCID between two SCID systems might not.
Agreed. At present the main issue in moving code is line terminators
(unless you're fighting the ASCII <--> EBCDIC battle). The benefit of
text is that file transfer software (FTP, Kermit, etc) does this 'for
free' but even if it doesn't, very simple tools such as tr, dos2unix and
unix2dos will solve that problem.

I have a nasty suspicion that the transfer weapon of choice between SCID
implementations might turn out to be voluminous XML.
Typing is much faster than mousing for me. The text interface is
also simpler. I can use my own editor that fits my preferences rather
than getting locked into a GUI IDE.
Exactly the same here - I use a portable editor (microEmacs) which can be
easily set up to use exactly the same keystrokes on almost any system
with an ANSI C compiler. In particular, its ability to associate
customisable formatting conventions (tab-length, line-wrap, auto-indent,
etc) with the file extension so something I really miss in editors that
don't support it.

I prefer to develop Java with a command line, text editor and ant. I've
used IntelliJ and generally liked it once I'd gotten used to that busy
screen, except for one thing: apart from specific refactoring facilities
its text editor seemed to be missing all but the most basic editing
functions - there were times I'd have killed for a general-purpose regex-
based search-and-replace facility.
 
G

Gene Wirchenko

On Tue, 01 Nov 2011 09:41:00 -0700, Daniel Pitts

[snip]
I've often thought about a "new" way of representing code, where the
logical structure is stored in not-necessarily-human-editable format,
but the tools for managing the code allow it to be presented in a format
chosen by the particular maintainer.

One problem is whether you can replicate my way. I like my code
formatted a certain way. If your tool can not do this, I will not
like using it. I will avoid it if at all possible.
Of course. The idea is that the view would be formatted to the
individual contributors taste. Including folding of constructs you don't
want to default visible, and potentially flowchart views or dependency
graphs, etc... With an model that is more than an AST, much is possible.

Yes, that is the idea, but where is the execution? I find my
style to be readable for what I do. I do not want to lose it.
Other people feel the same way about their formats. Miss very
many possibilities, and you will have bad will from [|potential]
users.

I was wading through the editor settings for Visual Studio and
ended up having to shut off a lot of the formatting, because the
formatting done was not to my taste.

I was just looking through the editor settings for Dreamweaver.
It does not do what I want.<sigh>
This is getting a little off topic, but I would like to say the IntelliJ
IDEA has a very flexible configuration for formatting that can do most
of what you want. At the same time, being personally inflexible in what
style you're willing to work in will limit your ability to work on many
teams. I recently have started working on an open-source project which
has different style than I am used to, or even prefer. Luckily, IntelliJ
IDEA can be set up to switch between styles for different projects.

Oh, if I have to work with a particular format, then I use it.
Given a choice, I use my preferences.
A single loop, yes, but aspects (joins and advice) can be more difficult
to navigate. My idea was to make *everything* easier (or no more
difficult) than it already is.

Good luck. You are going to have to replicate a lot.
Some programmers I know should be in a straitjacket :)
Yes, consider that a typo :)

And what does "'concrete' manner" mean?
I think a good solution to that particular problem is to have an
unimplemented predicate method:
while (thisLoopShouldContinue(i) {...}

@ToImplement boolean thisLoopShouldContinue();

That is unnecessarily complex for my example (which is a common
case for me). It might be a matter of *seconds* before I determine
what goes in the place. I do not need a "to be done". All I need is
something wrong so if it compiles, there is an error message. I might
already have part of the expression.
In general, "uncompilable fragments" would probably have to be supported
at some levels. Since the tool would maintain a structured model, the
fragments couldn't accidentally interfere with other parts of the code.
For example, and extra ")" or "}" would be localized to the context it
was entered in.

You're talking a lot about old-tech editors. Would you disable
spell-checking on a document editor? Modern IDEs will highlight errors

If it interfered. I use Word. I have turned off spelling
suggestions since they are often laughable. I turned grammar checking
long ago since I have good grammar and could never figure out what the
suggestions meant.
and warnings, without a lot of fuss. Yes, I sometimes leave a line
half-finished too, and I'm grateful that my IDE will remind me to go
back to that line when I get distracted on something else.

My "*****" works wonders for that.

Sincerely,

Gene Wirchenko
 
D

Daniel Pitts

My "*****" works wonders for that.

Sometimes, it is better to bend yourself to a tools whim than to refuse
to use the tool. I grant you that is not always, true, but the tool was
created to make life easier for some. Instead of saying why a tool will
get in your way, consider thinking of ways to make the tool better.

To each their own. You are one of the rare few that refuse to let
useful tools help them in their daily lives, because past versions of
them didn't live up to your expectations.

I can only please a certain number of people a day, and today is not
your day. Tomorrow doesn't look good either. Ciao.
 
D

Daniel Pitts

I prefer to develop Java with a command line, text editor and ant. I've
used IntelliJ and generally liked it once I'd gotten used to that busy
screen, except for one thing: apart from specific refactoring facilities
its text editor seemed to be missing all but the most basic editing
functions - there were times I'd have killed for a general-purpose regex-
based search-and-replace facility.

What version of IntelliJ did you use? I'm using 10 now, and it has had
regex search/replace for a long time. It also has structural search and
replace, which is a bit more powerful but more complicated to set up.

On top of all that, the editor has really good auto completion support.
It's gotten so smart about it that you don't even need to use hot-keys
for auto completion; just use the punctuation you would use normally,
such as parenthesis or dot. Sure, it will rarely get in the way and do
the wrong thing, but by and large it greatly improves my productivity.
 
D

Daniel Pitts

Typing is much faster than mousing for me. The text interface is
also simpler. I can use my own editor that fits my preferences rather
than getting locked into a GUI IDE.
No one says you have to use a mouse. Typing is *much* faster for me for
most tasks. You can have a GUI view that is focused on pointer-based input.
I tend to find such things distracting and prefer to not have
them.
Which is why such things tend to be configurable. Maybe when you start
working on sufficiently large code-bases, you'll appreciate these
productivity enhancers. Or maybe you'll always be a second-tier engineer.
 
G

Gene Wirchenko

Sometimes, it is better to bend yourself to a tools whim than to refuse
to use the tool. I grant you that is not always, true, but the tool was
created to make life easier for some. Instead of saying why a tool will
get in your way, consider thinking of ways to make the tool better.

Sometimes. And sometimes, it is better to just keep it simple
and get on with it.
To each their own. You are one of the rare few that refuse to let
useful tools help them in their daily lives, because past versions of
them didn't live up to your expectations.

Well, no. There are plenty of people who choose to continue
using something that works for them and avoid something that does not.
I can only please a certain number of people a day, and today is not
your day. Tomorrow doesn't look good either. Ciao.

Do not develop a developer's tool today or tomorrow. How is
Friday looking?

Sincerely,

Gene Wirchenko
 
M

Martin Gregorie

What version of IntelliJ did you use? I'm using 10 now, and it has had
regex search/replace for a long time. It also has structural search and
replace, which is a bit more powerful but more complicated to set up.
I can't remember the version, but it was back in spring, 2008.
On top of all that, the editor has really good auto completion support.
Sounds like its come on a long way since I last saw it.
 
L

Lew

What version of IntelliJ did you use? I'm using 10 now, and it has had
regex search/replace for a long time. It also has structural search and
replace, which is a bit more powerful but more complicated to set up.

NetBeans and Eclipse also have full-featured regex search(-and-replace), and have had for a long time.
 
G

Gene Wirchenko

On 11/2/11 9:47 AM, Gene Wirchenko wrote:
[snip]
I tend to find such things distracting and prefer to not have
them.
Which is why such things tend to be configurable. Maybe when you start
working on sufficiently large code-bases, you'll appreciate these
productivity enhancers. Or maybe you'll always be a second-tier engineer.

Or perhaps, I will hold a reasonable opinion for good reason that
is different from yours regardless of your insults.

Sincerely,

Gene Wirchenko
 
L

Lew

Gene said:
Daniel Pitts

Or perhaps, I will hold a reasonable opinion for good reason that
is different from yours regardless of your insults.

I think you guys should retire to your corners and grab a squirt-and-spit of water before the next round.

DING!
 
A

Arne Vajhøj

I prefer Roedy's version here, it's easier to read. Never say never, and
never say always. You can omit braces when they reduce code readability.

Do they ever reduce the readability enough to outweigh:
* the risk of an extra statement being incorrectly added
* not following Java coding convention
?

I would tend to say no.

Arne
 
A

Arne Vajhøj

I've often thought about a "new" way of representing code, where the
logical structure is stored in not-necessarily-human-editable format,
but the tools for managing the code allow it to be presented in a format
chosen by the particular maintainer.

In other words, you have the language constructs (classes, methods,
fields, statements, aspects, loops, etc...) modeled, and then have view
in front of that model which make them "look" like something that can be
manipulated easily by the programmer.

I would imagine such a system has a bit of ramp-up time, but it would
eventually allow you to be much more productive. The "concrete" manor
that the object model stores things would allow you to refactor very
easily.

According to various rumors then VS 2012 will allow
the developers to view a given piece of code as C# or
VB.NET as a choice.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top