121
Ideas / Re: Function inside function
« on: September 24, 2018, 12:20:16 PM »
Features like this are not used very often in C and do make a language more complex than needed. So it was removed.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
while (Ptr* p = getPointer()) {
..
}
type Color enum u8 { Red, Green, Blue }
func bool Color.isRed(const Color* color) {
return *color == Red
}
while (Height h = getHeight()) {
..
}
while ( decl/expr ) {
while ( expr ) {
while ( u32 x = get(), u32 y = getY(); x < y && x > 0) {
func void point_add(Point* p, int32 x) { .. } // current syntax
func void Point_add(Point* p, int32 x) { .. } // allow Upper-case as first char, so looks more like type Point
func void point_add[Point](Point* p, int32 x) { ..} /// hmm, 3 points in a row..no
func void point_add(Point* p, int32 x) @{structfunc} { ..} // via attribute
func void point_add(Point* p, int32 x) @{struct='Point'} { ..} // via attribute, nr 2
func void Point.add(Point* p, int32 x) { .. } // most explicit, via member operator
..