| I just saw your reply from a long time back @ http://arclanguage.org/item?id=18020 ... thanks for your feed back and my apologies for not replying sooner. "Very interesting! Particularly the <- and -> operators. It's refreshing
to see new approaches to stack shuffling that don't come from the kind
of established zeitgeist of stack shufflers (dup, swap) & combinators
(dip, bi, tri). I was confused by the notions of the "downstack" and
"upstack", because it looks to me that you really only have one stack,
and a cursor into it," This is conceptually correct, but the stacks are maintained separately so
when I refer to "two stacks" I'm referring to an implementation detail. Based
on your feedback, I'll update the documentation to make this clearer. "Also, it seems to me the language isn't really "typeless"; rather, the
programs aren't generally type-directed." I do not mean "typeless" in any kind of rigorous sense. It is not type-
enforced. There are, of course, implicit types within the language since
applying the wrong operators to the wrong data will produce gibberish or
even cause the interpreter to fail. Right now, it is fairly easy to induce
the interpreter to crash. Later on, the interpreter will have more safety
checks to protect against type errors that can result in an interpreter
crash. "The system appears similar to Arc's, where you have a few already-used
type tags (string, int, num), but in principle the tags are arbitrary.
I suppose one distinction could be the treatment of the data under
certain operations: Bipedal has syntax for strings and integers, but what
happens when you call + on a string and an integer? Is it just treated
like adding the string's address with the integer, perhaps?" No, both the string and the integer are stored at "the same level of
dereference", so to speak. So {'a' 1 +} will actually work and the result
will be 0x62 (the ASCII code of 'b'). Note that: {'b' 'a' 1 + =} -- '=' denotes comparison, not assignment
... will evaluate to not-equal. The reason is that 'b' is encoded as an
"array-8" which means that it gets an additional mword to show the alignment
of the string (since there are 4 bytes per mword on a 32-bit machine, etc.)
This is called the "alignment word" in the documentation. The + operator,
however, does not create array-8 output, it just creates a new mword and
puts the sum of the first entry of TOS and TOS-1 into the new mword. Here's a
debugger output showing the execution of the above code: > t <-- (t means "step and show dstack"
(val 0x62 0xffffff00 )
> t
(val 0x61 0xffffff00 )
(val 0x62 0xffffff00 )
> t
(val 0x1 )
(val 0x61 0xffffff00 )
(val 0x62 0xffffff00 )
> t
(val 0x62 ) <--- notice the result of + doesn't have the ..fff00
(val 0x62 0xffffff00 )
> t
(val 0x1 ) <-- 1 means "not equal" b/c this is C's memcmp()
> q
As a side note, you can use a trick to get what you "expect" in the case of
adding 1 to 'a' (that is, 'b'): {'a' 1 +=}
The "add and assign" operator will add "in-place" without allocating new
memory for the result. Thus, you get 1 added into the 'a' to give 'b': > t
(val 0x61 0xffffff00 )
> t
(val 0x1 )
(val 0x61 0xffffff00 )
> t
(val 0x62 0xffffff00 ) <-- 'b' as "expected"
> q
As in C, this is not a feature or a bug... it's just something that is
possible but probably doesn't ever really make sense to do. Should it warn?
I don't know, but it will definitely be possible to make it warn if that's
something you care about... at the cost of performance, of course."Finally, I'm interested by the crypto angle. Do you think this is just a
generally important (or interesting) feature, or is there a particular
application you have in mind? [I said, hoping you're still checking this
forum. :)]" I think it's generally important. I hope to one day leverage the crypto
capability to build an Babel-driven client-side encrypted virtual file-
system for "cloud" computing (scare-quotes because cloud is a particularly
obtuse buzzword, IMO). Do check in on my website (babelscript.net) from time to time as I will be
updating it as I go. I'm a stickler for documentation but it's of course
very difficult to keep the docs up-to-date. The more people who read the
website, however, the more motivated I will feel to make sure everything is
up-to-date. Clayton - |