Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: MySQL protocol bug

From: joel::neely::fedex::com at: 19-Feb-2004 10:34

Hi, Maxim, Pardon my being picky, but we can take your point even further... Maxim Olivier-Adlhoch wrote:
> in rebol, creating a function is an expression! so you usually write: > >>funcname: func [arg] [put your code here] >
Although we *may* write something like that, when we do so we are actually combining two distinct concepts in one expression: 1) defining a function, and 2) making a particular word refer to that function. and the habit of thinking of those two together results in one of the standard newbie questions: "How can I find out the name of this function?" which is no more meaninful than asking for "the name" of a value of any other type. (Of course, that's what it means to say that functions are first-class values...) "How can I find out the name of 2?" "How can I find out the name of {Hello, world!}?" etc.
> Now, how many languages will handle a stray value in code > without choking... not even python will let you insert a > string anywhere in its code, if its not being used by a > function. > ... > python or c would give you a syntax error, because it excepts > ALL values to be part of a structure, which is defined by > strict syntax and parenthesis useage. When it encouters > bogus data, it just cant handle it, cause it differentiates > values and functions. IMHO rebol does not. They really are > all just values, even functions. >
The following (console transcript) shows that one *can* insert values (e.g. strings) into the body of a Python function when such values aren't actually used for anything.
>>> def somefunc (x, y):
.... """silly function containing pointless string""" .... x2 = x * x; .... y2 = y * y; .... "foo?"; .... print x2 + y2; ....
>>> somefunc (3, 4)
25 One can do similar things in Perl. The parser will let you know that the value is not used; surely you don't think that's all bad??? How many of us have *never* made a typo in a REBOL script that changed the meaning of something in a way that produced an error, but the interpreter never helped us find it? (However, Perl will still run your program after whining at you.) For example, take a largish REBOL script and delete a single occurrence of '+ somewhere in the middle. -- ---------------------------------------------------------------------- Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446 Enron Accountingg in a Nutshell: 1c=$0.01=($0.10)**2=(10c)**2=100c=$1