A friendly version of EDIT for the new user needs a black belt programmer 
Author Message
 A friendly version of EDIT for the new user needs a black belt programmer

If the newby user trys to edit a word or tries to view a file he will
fail.  Lets make a smart (and friendly) word that will look in both
places.

I need some hints on how to code the following.

A smart combination of:
ED <file> and                   (Ed taks a file name not the name of a
word)
EDIT <word>                   ( Edit takes the name of a word not a
file name)

Here is some source from Win32Forth to work with.

INTERNAL

: _$watch       ( line filename -- )
                ['] do-watch  [$edit] ;

' _$watch is $watch     \ link watch into the de{*filter*}

in-system

: locate-height ( -- n1 )
                getcolrow nip 8 - 20 min ;

: locate-header ( -- n1 )
                locate-height 4 / ;

-1 value orig-loc

: $locate       ( line# filename | dummy -1 -- )
                { line# file$ \ loc$ locHdl lcnt -- }
                file$ 0< ?EXIT
                max-path LocalAlloc: loc$
                file$ $open abort" Couldn't open source file!"

      Why not try looking for a word at this point? ^^^^^^^^

                to locHdl
                0 to lcnt

                cls >bold ." From file: " cur-file count type
                ."  At line: " line# . line# cur-line !
                cr horizontal-line
                line# locate-header - 0 max 0
                ?do     loc$ MAXCOUNTED locHdl fread-line
                        abort" Read Error"
                        nip 0= ?leave
                        1 +to lcnt
                loop
                locate-height 0
                do      loc$ dup MAXCOUNTED locHdl fread-line
                        abort" Read Error"
                        if      cols 1- min
                                1 +to lcnt
                                lcnt orig-loc =
                                if      horizontal-line
                                        >bold type cr
                                        horizontal-line
                                else          type cr
                                then
                                getxy nip getcolrow nip 4 - >
                                ?leave
                        else    2drop leave
                        then
                loop    horizontal-line
                locHdl fclose-file drop
                r> base ! ;

in-application

EXTERNAL



Thu, 07 Apr 2005 06:55:46 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer



Quote:
> If the newby user trys to edit a word or tries to view a file he will
> fail.  Lets make a smart (and friendly) word that will look in both
> places.

> I need some hints on how to code the following.

> A smart combination of:
> ED <file> and                   (Ed taks a file name not the name of a
> word)
> EDIT <word>                   ( Edit takes the name of a word not a
> file name)

    A "newby" is likely to be confused by EDIT taking a word as its argument
when he's likely to expect it to take a file name.  It's by ignoring such
expectations that Forth is seen as such an oddball language.

--

-Gary Chanson (MVP for Windows SDK)
-Software Consultant (Embedded systems and Real Time Controls)

-War is the last resort of the incompetent.



Thu, 07 Apr 2005 11:53:17 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer

Quote:

> when he's likely to expect it to take a file name.  
> It's by ignoring such expectations that Forth is
> seen as such an oddball language.

Do you like the idea that Forth is seen as an
oddball language?

best wishes,
Jeff Fox



Thu, 07 Apr 2005 14:54:39 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer


Quote:

> > when he's likely to expect it to take a file name.
> > It's by ignoring such expectations that Forth is
> > seen as such an oddball language.

> Do you like the idea that Forth is seen as an
> oddball language?

    Of course not.  Do you?

--

-Gary Chanson (MVP for Windows SDK)
-Software Consultant (Embedded systems and Real Time Controls)

-War is the last resort of the incompetent.



Thu, 07 Apr 2005 15:44:01 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer
Here's a different approach to consider.  I would have the user invoke a
menu command (with a keyboard equivalent).  The menu command for a word
lookup would be different than for a file edit.  Whatever word is hilited
would be the word/filename to look up.  This is a pretty standard Windows
user interface technique (first select the object, then act on the object).

Going a step further in ease of use the word/filename need not actually be
hilited (although it could be), the editor could simply pick the nearest
word to the current position of the blinking vertical caret.  So the user
could simply drop the caret in or next to the word/filename and invoke the
menu command.  This would also mean the user could type the word/filename
and then simply invoke the command since the caret would be at the end of
the word (avoids having to use the mouse or whatever to first hilite the
word/filename).

In either case, the above is less work (less typing) than " EDIT <word>".

Isn't there already a hypertext-like word lookup feature in the Win32Forth
editor?  Also, multi-word filenames would require hiliting the entire
filename.

-Doug

Quote:

> If the newby user trys to edit a word or tries to view a file he will
> fail.  Lets make a smart (and friendly) word that will look in both
> places.

> I need some hints on how to code the following.

> A smart combination of:
> ED <file> and                   (Ed taks a file name not the name of a
> word)
> EDIT <word>                   ( Edit takes the name of a word not a
> file name)



Thu, 07 Apr 2005 18:50:53 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer

Quote:

> Here's a different approach to consider.  I would have the user invoke a
> menu command (with a keyboard equivalent).  The menu command for a word
> lookup would be different than for a file edit.  Whatever word is hilited
> would be the word/filename to look up.  This is a pretty standard Windows
> user interface technique (first select the object, then act on the object).

SwiftForth offers EDIT as an optional thing to do with a selected word.
It can be accessed by menu, by right-clicking on a word, or from the
keyboard.  If typed, it can be followed by the name, but if there's no
text (or the selection comes from menu or right-click) the most recently
selected word is the target.  If there's text, it can be a filename; SwiftForth

can distinguish a filename from a word by expecting an extension on the
filename.  If there's no text and no word has been selected, an empty
string is used.

In all cases, SwiftForth passes commands to the user-selected linked
editor, which is normally launched with the appropriate file launched
and positioned to the definition of the selected word (if any).  If there's
no text or a filename that doesn't exist in the current path, the editor
responds however it responds (error message, offer to create new
file, etc.).

A "friendly" behavior should be Windows-friendly as well as
keyboard-friendly in a Windows program.

Cheers,
Elizabeth



Thu, 07 Apr 2005 22:55:52 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer

Quote:

> > Do you like the idea that Forth is seen as an
> > oddball language?

>     Of course not.  Do you?

Calling Forth an oddball language is the sort
of thing that people who don't like Forth say
about it.  Where do they get such an idea?
My guess is that they hear that this what
Forth programmers say about it.  It starts
here.  Is that a good thing?

If you do not like the idea that Forth is
seen as an oddball langauge does repeating the
negative sound-byte as if it were true help?

As for the issue of what newbies think I am always
amazed that what so many people assume is that newbies
will think like C and expect things to look like C.
Those are not newbies, those are C programmers,
perhaps newbies to Forth, but the problem there is
not learning Forth with an open mind, it is trying
to overcome the idea that what is good in C is also
a good thing for Forth.

In fact I agree with you that EDIT editing words or
files is not a good idea.  If they have an open mind
and are truely newbies people would not expect either
one.  I am of the opinion that EDIT takes ( n --- )
in Forth.

best wishes,
Jeff Fox



Fri, 08 Apr 2005 01:45:33 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer
Mr. Fox, may I suggest that you read first, comment later.
Below is an annotated verbatim copy of your post. Annotations have *
as first character of line.

Quote:


> > when he's likely to expect it to take a file name.
> > It's by ignoring such expectations that Forth is

*   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quote:
> > seen as such an oddball language.

*   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* It seems obvious to the most causal observer that Mr. Chanson's
* point was that ignoring the user's expectations can give Forth
* a bad reputation.

Quote:

> Do you like the idea that Forth is seen as an
> oddball language?

* This gets a close to a perfect non sequitur as possible, I think.

Quote:

> best wishes,
> Jeff Fox

So Forth is different, so what?
'Oddball' like beauty is probably in the eye of the beholder.

A. PROVEN NEWBIE
( ask anyone who has seen some of my code ;)



Fri, 08 Apr 2005 02:42:16 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer

Quote:

> If there's text, it can be a filename; SwiftForth
> can distinguish a filename from a word by expecting an extension on the
> filename.

Yes. If the discipline of a .xxx extension is enforced for filenames then
distinguishing words from filenames becomes straightforward.  As a user of
that other OS I often forget about that.  ;-)

-Doug



Fri, 08 Apr 2005 03:15:11 GMT  
 A friendly version of EDIT for the new user needs a black belt programmer

Quote:

> Mr. Fox, may I suggest that you read first, comment later.
> Below is an annotated verbatim copy of your post. Annotations have *
> as first character of line.



> > > when he's likely to expect it to take a file name.
> > > It's by ignoring such expectations that Forth is
> *   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > seen as such an oddball language.
> *   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Mr. Owlett,  I have reread the above post.  Who is it
that is 'ignoring' the expectations of users and
creating a language that will not do what people would
natually expect the language to do?  It is the people
writing the Forths.  It says that Forth authors, we,
ignore what users want and expect and that this is
why Forth is rightly seen as an oddball language.

Quite frankly I think it is seen as an oddball language
because Forth authors tell people that Forth authors
ignore what users want and expect and that this is
why Forth IS an oddball language.

Quote:
> * It seems obvious to the most causal observer that Mr. Chanson's
> * point was that ignoring the user's expectations can give Forth
> * a bad reputation.

Yes.  It states that the bad reputation is deserved.  It
doesn't say the reputation is wrong.  It explains why
these damaging rumors are valid and encourages them.
This is why I wondered why he would promote this idea
and reinforce the bad reputation.

Quote:
> > Do you like the idea that Forth is seen as an
> > oddball language?

IE. Why tell people that Forth deserves this reputation?
Is it a good thing to claim that such damaging rumors are true?

Quote:
> * This gets a close to a perfect non sequitur
> as possible, I think.

?

Quote:
> So Forth is different, so what?
> 'Oddball' like beauty is probably in the eye of the beholder.

I realize that most brilliant people are odd people.  They
are not average.  SVFIG meetings are a good example of a
bunch of odd people and they like Forth.

But oddball clearly has a negative connotation.  It is a
negative sound-byte.  My point is that if you like Forth
and think being an oddball language is a good thing then
maybe there is a better way to put it that won't
damage Forth's reputation.

Oddball, a person who's behavior is unusual or strange.

OK, unusual as is above average quality would be fine
but that is not how people will take it.  It is one
of the damaging sound-bytes directed against Forth.

Quote:
> A. PROVEN NEWBIE
> ( ask anyone who has seen some of my code ;)

I don't get the reference.  What would they say?

best wishes,
Jeff Fox



Fri, 08 Apr 2005 03:04:59 GMT  
 
 [ 20 post ]  Go to page: [1] [2]

 Relevant Pages 

1. CW4 - User friendly vs. friendly user

2. new user, new programmer

3. new user,new programmer

4. Request Editing/criticism re. Oberon new-users

5. Ann: EDIT (DOS editor for GNAT), new version

6. US-New York/New Jersey: Smalltalk and C++ programmers needed

7. general programmers for new users

8. New Forum for IGen CogNet Programmers/Developers/Users

9. CFV: comp.unix.user-friendly

10. User-friendly & powerful synthesizer

11. User-friendly & powerful synthesizer

12. A user-friendly Lisp debugger !

 

 
Powered by phpBB® Forum Software