2015-08-07 07:23:09 +00:00
|
|
|
// Copyright 2015 The go-python Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2015-08-12 06:49:06 +00:00
|
|
|
// package named tests various aspects of named types.
|
2015-08-07 07:23:09 +00:00
|
|
|
package named
|
|
|
|
|
2019-06-07 09:55:03 +00:00
|
|
|
// TODO: not dealing with named basic types -- not very intuitive to use
|
2019-03-06 10:41:03 +00:00
|
|
|
// in python, as they have to become classes. instead anything like this
|
|
|
|
// is converted to its basic type when used as an arg / return value
|
|
|
|
// so you can use them in other methods, but their special type methods
|
|
|
|
// are not exported
|
|
|
|
|
|
|
|
// type Float float32
|
|
|
|
//
|
|
|
|
// // Value returns a float32 value
|
|
|
|
// func (f Float) Value() float32 { return float32(f) }
|
|
|
|
//
|
|
|
|
// type X float32
|
|
|
|
// type XX X
|
|
|
|
// type XXX XX
|
|
|
|
// type XXXX XXX
|
|
|
|
//
|
|
|
|
// // Value returns a float32 value
|
|
|
|
// func (x X) Value() float32 { return float32(x) }
|
|
|
|
//
|
|
|
|
// // Value returns a float32 value
|
|
|
|
// func (x XX) Value() float32 { return float32(x) }
|
|
|
|
//
|
|
|
|
// // Value returns a float32 value
|
|
|
|
// func (x XXX) Value() float32 { return float32(x) }
|
|
|
|
//
|
|
|
|
// // Value returns a float32 value
|
|
|
|
// func (x XXXX) Value() float32 { return float32(x) }
|
|
|
|
//
|
|
|
|
// type Str string
|
2015-08-11 16:55:57 +00:00
|
|
|
|
2015-08-12 06:49:06 +00:00
|
|
|
// Value returns a string value
|
2019-03-06 10:41:03 +00:00
|
|
|
// func (s Str) Value() string { return string(s) }
|
2015-08-11 16:55:57 +00:00
|
|
|
|
|
|
|
type Slice []float64
|
|
|
|
|
|
|
|
func (s Slice) At(i int) float64 { return s[i] }
|
|
|
|
|
|
|
|
type Array [2]float64
|
|
|
|
|
|
|
|
func (a Array) At(i int) float64 { return a[i] }
|
2015-08-31 16:12:07 +00:00
|
|
|
|
2019-03-06 10:41:03 +00:00
|
|
|
// type T int
|
|
|
|
//
|
|
|
|
// func (t T) PublicMethod() {}
|
|
|
|
//func (t T) privateMethod() {}
|