Issue Details (XML | Word | Printable)

Key: BOO-443
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Rodrigo B. de Oliveira
Reporter: Doug H
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Parameterless initialization of structs

Created: 16/Aug/05 01:55 PM   Updated: 21/Nov/05 01:20 PM
Component/s: Compiler
Affects Version/s: 0.5.6
Fix Version/s: 0.7.5

Time Tracking:
Not Specified

Issue Links:
Duplicate
 


 Description  « Hide
sz = Size()
sz.Height

Using the initobj opcode instead of newobj opcode, like C#:

using System;
using System.Drawing;

namespace csharp
{

class MainClass
{

public static void Main(string[] args)

{ Size sz = new Size(); sz.Height = 100; System.Console.WriteLine(sz); Point pt = new Point(); pt.X = 3; System.Console.WriteLine(pt); }

}
}



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Rodrigo B. de Oliveira added a comment - 16/Aug/05 02:20 PM
In boo you can just declare the struct variable and use it:

sz as Size
sz.Height = 100
print sz

pt as Point
pt.X = 3
print pt


Doug H added a comment - 16/Aug/05 02:42 PM
"sz as Size; sz.Height=100" works

Rodrigo B. de Oliveira added a comment - 21/Nov/05 01:20 PM
resolved BOO-540 (which also solved this duplicate)