+=

classic Classic list List threaded Threaded
48 messages Options
123
Reply | Threaded
Open this post in threaded view
|

RE: +=

Philippe Lhoste-2
Edgar Toernig wrote:
> But if the color makes syntactic and semantic differences?!?  I'm not
> sure of I should like that.  IMHO it's just a matter of time until he
> makes special glyphs for each word so that a complete program fits on
> the display of a modular phone ;-)

Such a language exists (or existed), it is named APL (A Progamming
Language)...
I believe it was created by IBM, it is powerful to handle arrays and
matrices, it is very very terse, but uses a lot of cryptic symbols.
Actually, a symbol stands for a keyword.
Symbols needed special keyboard and/or special (text) display: most of them
were created by overwriting two glyphs on the same screen space...
Nice language for those who don't like to type (the opposite of spectrum to
Cobol...), but a nightmare to read!

Regards.

--._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`--


Reply | Threaded
Open this post in threaded view
|

RE: +=

Reuben Thomas-4
> Nice language for those who don't like to type (the opposite of spectrum to
> Cobol...), but a nightmare to read!

Only a nightmare to read in the sense that any new writing system is; once
you've learned it, it's a lot quicker (I understand) than reading an
ordinary program, since it's so much briefer and more expressive for a wide
range of mathematical operations.

This is an advantage over J and K, APL-derived languages that use ASCII. On
the other hand, they don't need special fonts or keyboard stickers...

-- 
http://sc3d.org/rrt/ | egrep, n.  a bird that debugs bison


Reply | Threaded
Open this post in threaded view
|

RE: +=

Stefano Lanzavecchia
In reply to this post by Steve Dekorte-4
> Only a nightmare to read in the sense that any new writing
> system is; once
> you've learned it, it's a lot quicker (I understand) than reading an
> ordinary program, since it's so much briefer and more
> expressive for a wide
> range of mathematical operations.

It is, I can confirm, having being an APLer for years now. It's much easier
to read a program which fits in two lines (no obscuring involved) than a
program spread on several pages of verbose code.

> This is an advantage over J and K, APL-derived languages that
> use ASCII. On
> the other hand, they don't need special fonts or keyboard stickers...

Well, the debate on whether J's ASCII combinations are easier to understand
than APL's symbols will continue forever. The one sure thing is that J is
easier to exchange because it's ASCII based, but the fact that many of the
symbols are two characters combinations, which make it look like cartoon
swearing, makes it also rather difficult to read.

Example:

   cmp1=: {.@(\:|)@:(*@-)

is a valid J's function definition (similar to C's strcmp but for arrays of
numbers instead of strings). Notice in particular "{." which is a single
primitive, different from "{", also different from "{:", in the same way "@"
is different from "@.", also different from "@:"... Spaces are not required
because there are no ambiguities. For a computer parser, maybe.


On the other hand, I never needed stickers for my APL keyboard. I just
learnt the position of all the symbols. It's easier than one would think.

Sorry for the off-topic, by the way.
--
WildHeart'2k1 - [hidden email]
Homepage: http://come.to/wildheart/

<<<All young children can pilot mecha, you just need to give them a few
days.  ---
   All I Ever Learned, I Learned From Anime:>>>


Reply | Threaded
Open this post in threaded view
|

:? syntactical sugar request

Steve Dekorte-4
In reply to this post by Michael T. Richter-2

In Lua, if you want to send a message to an object, but only if that method exists you can do:

if object.message then
 object:message()
end

The equivalent in NewtonScript is:

object:?message()

I was thinking if lua had a hook for a ? look whose default behavior was the same as a "." lookup but could be overridden, this syntax would be easy to implement in lua...

Steve

Reply | Threaded
Open this post in threaded view
|

Re: :? syntactical sugar request

Luiz Henrique de Figueiredo
>In Lua, if you want to send a message to an object, but only if that 
>method exists you can do:
>
>if object.message then
>  object:message()
>end

You could add an "index" tag method for this.  Something like this:

 local NOP=function () end
 settagmethod(tag(object),"index", function () return %NOP end)

--lhf

Reply | Threaded
Open this post in threaded view
|

Re: :? syntactical sugar request

Steve Dekorte-4

On Monday, April 9, 2001, at 11:19 AM, Luiz Henrique de Figueiredo wrote:

You could add an "index" tag method for this.  Something like this:

 local NOP=function () end
 settagmethod(tag(object),"index", function () return %NOP end)

That works if you always want that behavior, but I'd like it to only return the nop function in particular cases.

Steve

Reply | Threaded
Open this post in threaded view
|

Re: :? syntactical sugar request

Luiz Henrique de Figueiredo
In reply to this post by Steve Dekorte-4
>> You could add an "index" tag method for this.  Something like this:
>>
>>  local NOP=function () end
>>  settagmethod(tag(object),"index", function () return %NOP end)
>
>That works if you always want that behavior, but I'd like it to only 
>return the nop function in particular cases.

If those "particular cases" depend on the table or index, then you can write

 settagmethod(tag(object),"index", function (t,i) DO SOMETHING HERE end)

--lhf

Reply | Threaded
Open this post in threaded view
|

Re: :? syntactical sugar request

Steve Dekorte-4

Luiz Henrique de Figueiredo wrote:
That works if you always want that behavior, but I'd like it to only
return the nop function in particular cases.

If those "particular cases" depend on the table or index, then you can write

 settagmethod(tag(object),"index", function (t,i) DO SOMETHING HERE end)

I should have been more specific - I'd like to be able to use both types of lookups on the same table.

For example:

function ChatApp:draw()
  self:drawOutputText()
  ...
end

function Socket:receive()
  ...
  self._delegate:?socket_received_(self, data)
end


In this example, the Socket's delegate happens to be the ChatApp. I'd like the delegate message to be sent if the ChatApp implements the socket_received_ method and to be ignored otherwise, but I want the drawOutputText to raise an error if it's missing. Same table, different lookup behavior.

Steve

123