[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Permanent" variables
From: |
kamaraju kusumanchi |
Subject: |
Re: "Permanent" variables |
Date: |
Fri, 5 Feb 2016 23:35:58 -0500 |
On Wed, Jan 27, 2016 at 5:03 PM, Sergei Steshenko <address@hidden> wrote:
>
> Use functions returning constant values, e.g.
>
> function s = lw()
> s = "linewidth";
>
> endfunction
>
> and then call it as
>
> lw()
>
> instead of
>
> lw
>
> you have.
>
> Applies to practically all languages, by the way.
Sergei already gave you a good solution. But I thought I would mention
another "trick" that might come in handy. In programming editors you
can define abbreviations that expand on the fly. For example, in vim,
I can define
:iab lw linewidth
Then whenever I enter lw and hit space/comma, it changes to
linewidth.There are ways to restrict this kind of expansion apply only
on just a few types of files (ex:- all .oct files). This way your
keystrokes will be minimal and at the same time the code is easily
portable.
raju
--
Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog
- Re: "Permanent" variables,
kamaraju kusumanchi <=