Re: nano & mega




Florian Groß wrote:

> Luckily, I have already mapped the special method names. Let me use the
> look up table from extract.rb:
>
> {
> "+" => "op_plus",
> "-" => "op_minus",
> "+@" => "op_plus_self",
> "-@" => "op_minus_self",
> "*" => "op_mul",
> "**" => "op_pow",
> "/" => "op_div",
> "%" => "op_mod",
> "<<" => "op_lshift",
> ">>" => "op_rshift",
> "~" => "op_tilde",
> "<=>" => "op_cmp",
> "<" => "op_lt",
> ">" => "op_gt",
> "==" => "op_equal",
> "<=" => "op_lt_eq",
> ">=" => "op_gt_eq",
> "===" => "op_case_eq",
> "=~" => "op_apply",
> "|" => "op_or",
> "&" => "op_and",
> "^" => "op_xor",
> "[]" => "op_fetch",
> "[]=" => "op_store"
> }
>
> I'd suggest using foo_bang for foo!, foo_p for foo? and foo_setter for foo=.

I've given this some more thought. If I do this, I could enforce a rule
that says no nono-method is to start with 'op_'. While that's skirting
potential clash, I think it would be okay. But I still have two others
problems.

How to deal with ?, !, =. That's a bit trickier, as its hard to enforce
a rule related to those. Things like '_p', '_setter', have too great a
chance for some actual method clash. So I have to figure something else
out for that.

Also, I have to distinguish class methods. Right now I do it with '::'
prefix, which under URI translation if '%3A%3A'. What will I do here?
"class_" prefix desn't work for the same reason as the above.

Also, am I overlooking any other potential pitfalls?

So here's an idea. While Ruby techinically allows any non-blank string
as a method name (ie. define_method "whatever you want!@#$%") I am as
sure as I can ever be that I will never use such a thing in Nano. Given
this, I need only worry about the literal cases. Now in file systems
the dash characeter '-' is pretty much unviserally accepted, but it's
not allowed in literal method names (expect for the op) So what if I
use that characeter as a distinguishing element? Would that work for
you?

So foo-bang, foo-p, foo-set, and class-foo, plus I might as well do:

{
"+" => "op-plus",
"-" => "op-minus",
"+@" => "op-plus-self",
"-@" => "op-minus-self",
"*" => "op-mul",
"**" => "op-pow",
"/" => "op-div",
"%" => "op-mod",
"<<" => "op-lshift",
">>" => "op-rshift",
"~" => "op-tilde",
"<=>" => "op-cmp",
"<" => "op-lt",
">" => "op-gt",
"==" => "op-equal",
"<=" => "op-lt-eq",
">=" => "op-gt-eq",
"===" => "op-case-eq",
"=~" => "op-apply",
"|" => "op-or",
"&" => "op-and",
"^" => "op-xor",
"[]" => "op-fetch",
"[]=" => "op-store"
}

I thik also I'd like to reduce all of them to a single dash if
reasonably possible, which would change a few of them.

What do you think of this?

Thanks,
T.

.



Relevant Pages

  • Re: Cobol work?
    ... A common example, using ... And the numeric prefix on ... I do indeed have programming methods that produce more stable, ... > there isn't a reason, ...
    (comp.lang.cobol)
  • Re: recycled phone numbers, was Re: Pollys gators
    ... In our previous house in Arizona, our number was the prefix, followed by ... For some reason, the phone ... so we went round and round with the phone company ... AKA Dame Sandy, Minister of Education ...
    (rec.crafts.textiles.quilting)
  • Re: Between and Query
    ... The reason ZC or the prefix to the ID was added in the first ... "John Spencer" wrote: ... reason to store the letters in the first place. ...
    (microsoft.public.access.queries)
  • Re: (OT) Fedora Core 3 Review
    ... being the nice person you are you'd prefix it with OT to indicate ... >> to others that the subject is not exactly what the group deals with, ... > So I can post anything that I think is interesting yet amusing? ... I thought Harold explained the reason for his post clearly enough, ...
    (alt.os.linux.suse)