logo       

[jira] Created: (BOO-482) Convert uppercased fields to properties: msg#00042

lang.boo.devel

Subject: [jira] Created: (BOO-482) Convert uppercased fields to properties

Convert uppercased fields to properties
---------------------------------------

Key: BOO-482
URL: http://jira.codehaus.org/browse/BOO-482
Project: Boo
Type: Wish
Components: Compiler
Versions: 0.6
Reporter: Doug Holton
Priority: Minor
Attachments: autoproperty.patch

Just posting this here in case anyone finds it useful. This is a compiler step
that creates a property wrapper for any upper-cased field, without the need for
the [Property] attribute. The field name is changed to add an underscore and
lower-case the first letter. Fields that are private or final are not wrapped
with a property.

example:

import System.Xml.Serialization from System.Xml
class C:
[XmlElement]
Name = "myname"

def doit():
print Name

c = C()
c.doit()
print c.Name

/////////////////////////// is converted to:

import System.Xml.Serialization from System.Xml

public class C(System.Object):

_name = 'myname'

def doit():
print Name

[XmlElement]
Name:
get:
return _name
set:
_name = value

c = C()
c.doit()
print c.Name


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise