Re: [Vala] Generics and Contract Programming
- From: Chris Molozian <chris cmoz me>
- To: Nicolas <c r n a wanadoo fr>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Generics and Contract Programming
- Date: Fri, 24 Jun 2011 13:55:23 +0100
Ah ok, it was the "of T" that I wasn't sure how to do.
Thank you,
Chris
On 06/24/11 13:48, Nicolas wrote:
Hi Chris,
1) For assertations, try this:
[indent=4]
def static foo (ref args : array of string, opts : T, ...) of T
requires (args.length > 1)
// do something
init
print "hello world"
2) For generics, try this:
[indent=4]
class Wrapper of G : GLib.Object
data : private G
def set_data(data : G)
this.data = data
def get_data() : G
return this.data
init
var wrapper = new Wrapper of string
wrapper.set_data("test")
var data = wrapper.get_data()
Regards,
Nicolas.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]