In Perl, all functions and operators are aware of their context, and can behave differently in different contexts. The two major contexts are scalar and list. Context can be forced by assigning to a scalar variable or a list variable respectively.

Example: the function localtime returns either a list of nine elements (in list context) or the current time in seconds since January 1, 1970 (in scalar context).

($sec,$min,$hour,$mday,$mon,$year,$wday,$isdst) = localtime(); # list context
$now = localtime(); # scalar context

An interesting feature is applying scalar context to an array or list. That returns the array's length (number of elements) or the list's last element.

--

ariels says: You can (also) force scalar context by saying scalar, or list context by evaluating in the (trivial) list context (...).

ConTEXT is a truly excellent freeware text editor developed by Eden Kirin. The software was developed simply because "After years and years gumbling with all kind of Windows text editors, I haven't found any of them to complete satisfy my needs, so I wrote my own.."1 It is currently only available for Windows platforms.

While pretty much anyone who ever uses Notepad for anything will no doubt find ConTEXT useful, it has been designed with software developers in mind. Features which are only really useful for programming such as auto indenting are included, and there is a very flashy highlighting function, which can be configured by the user to, for example, make comments go grey, make keywords go bold, and make text inside quotes go red, which allows you to easily tell if you have failed to close any quotes or brackets. This highlighting features is customisable to the extreme, and although the basic download comes with a large number of highlighter profiles (for Java, C++, HTML, Perl, Python, Fortran, ObjectPascal and more) it is possible to make and distribute your own (for example, I discovered the program on a Sega Master System programming site, and the link was accompanied by a Z80 Assembler highlighter file). A number of highlighter files are available on the ConTEXT site.

There is no limit to the number of files which can be open at once (which are thankfully all kept under one main button in the taskbar, and selectable from within the program) or the size of those files, and a single line can be up to 4 Kilobytes in length. The software is pretty fast, and while it's not quite as speedy as Notepad, I think considering all the extra features it provides, it's very efficient. All the usual find, search and replace etc. features are present, along with converting between DOS, Mac and Unix text formats, and Unicode as well. I have no doubt that I could spend years doing things on ConTEXT and never fully use all the features.

Probably the feature which impressed me most (although I have been writing my Java in Notepad so far, so pretty much anything would impress me) was the pre recording of functions which could be done. As well as Macros, there is huge scope for setting up, for example, auto compile options. In the SMS programming tutorial I read, the author had set up ConTEXT so that f9 automatically compiled whatever was being worked on, and other keys ran debuggers on the output. The function keys from 9 to 12 can be programmed pretty easily (I managed to get it to auto compile my Java, so it can't be that hard) and then any console output that appears is captured and appears as part of the ConTEXT window.

Naturally, the installer file manages not only to replace Notepad as the default text editor, it even replaces the Notepad file2 with a fake file which launches ConTEXT, for the few cases of programmes which have hardcoded calls to Notepad. This guy really does think of everything.

I only bothered to get this program because after installing a scanner, Notepad refused to print (giving some strange "Not enough Memory to print" message, even when it was the only thing running) but I'm actually glad that happened now, because I can see ConTEXT making my life a whole lot easier. If any of you are coders (and hey, this is E2, I'm sure a heck of a lot of you are) then I would highly recommend picking it up. It's free, it's fast, and it's writeen by a programmer for programmers. The program hasn't been going for too long, and there is definitely still room for improvement (according to the author, anyway; he has a huge list of things to add for version 1.00, including hex editor capability). I would use this for everything, but until someone can make it preview my nodes by pressing f9, I'm still keepin dann's Offline Scratchpad handy..


www.fixedsys.com/context/


1 - from the readme.txt
2 - The original file is renamed to Notepad.exe.bak - just in case...

Context is a concept that is much too easy to take for granted.

Say I was to ask you what you get when you multiply 6 by 9. Thinking back to those grade school times tables that you may or may not have dusted off and used since then, you could respond with 54. Not only do you have to recognize this as the written expression of a multiplication problem, but you also need to:

All of these are, to varying degrees, highly dependent on context: both on there being one and on the ability to properly recognize one.

Any information you come into contact with must be processed with a context in mind. Your eyes are highly developed photon collection and classification agents, whose rods and cones send a myriad complex signals to your brain, which then proceeds to make sense of them. That, along with the fine motor skills provided by a steady, experienced pair of human hands and some form of inscribing agreed-upon symbols from an alphabet, suggests that a system of directly codifying information to be transmitted visually—written language—has potential.1 This is all fine and good for society, but it requires you to be able to decode such a written language, as well as be able to tell apart meaningful from meaningless symbols. Hence, the need for context.

As was elegantly put by Douglas Hofstadter in the eternally-relevant GEB2, one can make distinct three types of message: the inner, the outer, and the frame message. To quote the text:

To understand the frame message is to recognize the need for a decoding-mechanism.
To understand the outer message is to build, or know how to build, the correct decoding message mechanism for the inner message.
To understand the inner message is to have extracted the meaning intended by the sender.

This is to say, the frame message is the way of showing that there is a message to be found in an organization of symbols; the outer message is the way that the message's creator conveys the mechanism from which to derive meaning from the organization of symbols; and then the inner message is the actual meaning to be gleaned from the symbols. This last one is the one that we are most familiar with, and what we most often assume is all there is to meaning.

The frame and outer messages are, in slightly differing ways, the conceptualizations of the ideas behind context. Often, if the message appears similar to the expression of a language you know in the same medium, then it is worth a shot to try to decode it as that language to see if anything comes out of it. At minimum, however, the structure may appear to be script- or message-like, whether or not it shares the same alphabet as the language of the medium you know, or if you don't know any, then at least that there seems to be some sort of content to be found. This can be manipulated by the structural aspects of the message, but ultimately relies on the ability of the reader to predict and utilise context effectively. (One can also argue that the inner message relies on certain references which may or may not require contextual setting, but for the sake of simplicity the actual content of the message is arbitrary and irrelevant.)

From this perspective, context is the bigger picture within which some information might be placed. The ability to predict and apply a context to a message is a very important skill, because there are often many things that require one's focus or attention, intermittently, and being able to call upon only relevant knowledge to properly operate is at least marginally useful.

This definition of context may not be too concise, but hopefully it contextualizes context a little bit for you.


1  A similar rationalization using the ears as paired with vocal chords and a sound-propagating medium such as air leads to verbal language. Anything with a consistently applicable and recreatable system of production and (mostly) unambiguous method of decoding can be such a language base. (Braille and touch-reading is another example.) The poor olfactory sense is, in this regard, unfortunately peerless and, therefore, languageless. (Or is it?)

2  Page 166 in the 20th anniversary edition. (s.v. The Location of Meaning, 'Three Layers of Any Message')

[IN12#21]

Con*text" (?), a. [L. contextus, p.p. of contexere to weave, to unite; con- + texere to weave. See Text.]

Knit or woven together; close; firm.

[Obs.]

The coats, without, are context and callous. Derham.

 

© Webster 1913.


Con"text (?), n. [L. contextus; cf. F. contexte .]

The part or parts of something written or printed, as of Scripture, which precede or follow a text or quoted sentence, or are so intimately associated with it as to throw light upon its meaning.

According to all the light that the contexts afford. Sharp.

 

© Webster 1913.


Con*text" (?), v. t.

To knit or bind together; to unite closely.

[Obs.]

Feltham.

The whole world's frame, which is contexted only by commerce and contracts. R. Junius.

 

© Webster 1913.

Log in or registerto write something here or to contact authors.