Re: Regex query

2002-09-22 Thread Pixel

Chip Salzenberg [EMAIL PROTECTED] writes:

 According to David Whipp:
(7,8,9) == 3 # true
(7,8)   == 2 # true
(7) == 1 # false
()  == 0 # true?
 
 Hell, yes, why didn't I think of that?  This is exactly the same
 problem that afflicts Python's tuple syntax!

various 1-uple syntaxes:

   a or [a]   Ruby
   a, Python
   tuple([a]) Python
   (a)Perl  
   ((a))  merd
   {a}Smalltalk 

http://merd.net/pixel/language-study/syntax-across-languages.html#Various Data Types



Re: Accessor methods ?

2002-05-13 Thread Pixel

Mark J. Reed [EMAIL PROTECTED] writes:

 On Sun, May 12, 2002 at 12:30:20AM +0200, Pixel wrote:
  FYI Ruby has:
  
  a.type = b.type  or  a.type == b.type
  
  [...]

 Well, it comes from set notation - and you used the prefixes 'sub' and
 'super' exactly as they are used in sets. :) 
[...]
 Anyway, if you regard a class as the set of objects which can be
 treated as instances of that class, then use of a Rubylike notation
 (and the terms 'subclass' and 'superclass') follows logically.

i do understand this notation [*], but i don't know if it's
*readable*. many people prefer: a.isa(b.type)

by the way, this notation seems to come from smalltalk.

and = on incompatible types now return an exception in Ruby 1.7


[*] i'm trying to develop a programming language (merd) which is very
based on subtyping/supertying.

--
Pixel
http://merd.net
merd = Perl-Python-Ruby-alike expressivity
 + static type checks (a la Haskell)



Re: Accessor methods ?

2002-05-11 Thread Pixel

David Wheeler [EMAIL PROTECTED] writes:

 On 5/11/02 2:43 PM, Damian Conway [EMAIL PROTECTED] claimed:
 
  method set_baz($newbaz is compatible($.baz)) { $.baz = $newbaz }
  method set_baz($newbaz is typeof($.baz)) { $.baz = $newbaz }
 
 I like the latter best -- and it beats the hell out of instanceof ;-)

talking about instanceof, here are the various syntaxes:

* testing class membership

  x isax Perl x
  x is_a? kind_of? x Ruby x
  x dynamic_cast   x C++  x
  x instanceof x Java x
  x isinstance x Python   x
  x in x Ada  x
  x is x C#   x
  x is_a   x PHP  x
  x entry_type x Pliant   x
  x ISTYPE x Modula-3 x
  x object##  classname## x Beta x
  x var ?= val (20)x Eiffel   x

* get the class corresponding to an object/instance

  x type  x Ruby   x
  x __class__ x Python x
  x getClass  x Java   x
  x typeidx C++x

if you know some more, tell me :)

http://merd.net/pixel/language-study/syntax-across-languages.html



Re: Please rename 'but' to 'has'.

2002-04-26 Thread Pixel

Larry Wall [EMAIL PROTECTED] writes:

 : Why not use a 16 bit int and specify that languages should use
 : default precedence levels spread through the range but keeping the
 : bottom 8 bits all zero. That gives 255 levels between '3' and '4'.
 : Seems like enough to me!
 : 
 : Floating point seems like over-egging the omelette.
 
 It's also under-egging the omelette, and not just because you
 eventually run out of bits.  I don't think either integer or floating
 point is the best solution, because in either case you have to remember
 separately how many levels of derivation from the standard precedence
 levels you are, so you know which bit to flip, or which increment to
 add or subtract from the floater.

On this subject, has it been considered doing it the Cecil way?

http://www.cs.washington.edu/research/projects/cecil/www/Release/doc-cecil-lang/cecil-spec-37.html
(no numbered priorities, but a partial-order relation on operators)

--
Pixel
programming languages addict  http://merd.net/pixel/language-study/