NISUS Archives

December 2010

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Tue, 28 Dec 2010 03:18:19 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (28 lines)
Hello Nobumi,

On Dec 27, 2010, at 5:47 PM, Nobumi Iyanaga wrote:

> On the other hand, I think that one thing which still lacks in Nisus macro language is the possibility of using sub-routine. When this will be possible, I think/hope that writing macros will be much simpler

I agree with you. Due to the lack of sub-routine, sometimes I have to write a verrrrrry long loop repeating several code blocks again and again in it. That is annoying.

> (but before that, we -- I -- should master the current macro language, which is not easy at all...!).


I remember the impression of something very stern I felt when I looked at NWP 1.1's Macro Reference for the first time. But believe me, it is far easier to master than it looks. For example, the naming scheme of commands is so consistent that you can know the syntax of a command from its name in most of the cases. Of course, I was in an uncommon situation. To test all new commands, I wrote a large number of small macros in a short period. So, if you do something similar (not for the current enlarged command set but for the basic one flagged as v1.1), I bet you will feel very comfortable with the NWP macro. It would take several days but worth trying, I think. Now I find the current NWP macro the easiest and the smartest of all the macro/scripting languages I have ever tried. NW Classic macro was simpler in some aspects but, with it, you were often forced to invent something acrobatic and tricky.

The same applies to the regular expression. If there is something I know and you don't, that is just because I tested all special characters and syntactic elements, including Unicode properties, e.g. \p{Hebrew}, when they adopted the new regex library in NWP 1.0.1.

BTW, according to my testings of years ago, the atomic group -- (?>subexp) -- is not especially efficient in NWP although it is supported properly. That does not mean that its implementation in NWP or in oniguruma (regex library) is bad. On the contrary, the regex library -- the one implemented in NWP at leaset -- seems to be very well optimized that you don't need using it in order to improve the performance. I'm not 100 % sure but that is my impression.

>> You can condense these three lines into:
>> 
>> $theRange = Range.new (0, $theExpression.length - 1)
> 
> Ah, I would have not been able to find this by myself.

Neither did I. Until I saw something similar in a macro written by Martin, I did not imagine such a construction to be possible.


Kino

ATOM RSS1 RSS2