rev 425 - trunk/pr

SVN User <[email protected]> Wed, 28 Apr 2004 03:19:49 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-04-28 03:19:46 -0400 (Wed, 28 Apr 2004)
New Revision: 425

Added:
   trunk/pr/new.pr
Log:
added new.pr

Added: trunk/pr/new.pr
===================================================================
--- trunk/pr/new.pr	2004-04-28 07:18:01 UTC (rev 424)
+++ trunk/pr/new.pr	2004-04-28 07:19:46 UTC (rev 425)
@@ -0,0 +1,21 @@
+#!/usr/bin/env prothon
+
+def New(proto, *args, **kwargs):
+    newObj = Proto(proto)
+    []
+    newObj.__init__(*args, **kwargs)
+    return newObj
+
+p = Object()
+with p:
+	$x = None
+	def $__init__(x):
+		$x = x
+	def $__str__():
+		return '*'+$x+'*'
+
+x = New(p, 1)
+print x
+
+y = New(p, 'a')
+print y