Feature Request (oh no!)
Blitz3D Forums/Blitz3D Programming/Feature Request (oh no!)
| ||
| Oh no, Picklesworth is at it again. This one is actually reasonable seeming though. But I always say that, so you may not believe me. I want to be able to set default type field values. This way, I wouldn't have to set up variables on them that are always the same at the start every time I create them. For instance: Type myType field Param1=true field Param2=52 End Type |
| ||
| You could create a function to set the type fields, and call it everytime a new type is created. :o) |
| ||
| This feature would actually be useful, Mr. Picklesworth, and has actually been requested before. Interestingly, you can specify default field values - as in your example - and it'll compile fine. It just won't actually do anything! :/ |
| ||
| Yeah, that would be a great help. :) Setting the default values every time a new type is created of course is the current method, but doesn't make for very clean code. /me adds a "Hear hear!" +BlackD |
| ||
not very Clean? It's cleaner in my opinion.
Type MyType
Field Param1
Field Param2
End Type
Function MyType_Constructor.MyType()
Local MyTypeReturn.MyType = New MyType
MyTypeReturn\Param1 = True
MyTypeReturn\Param2 = 52
Return MyTypeReturn
End Function
Local test.MyType = MyType_Constructor()
Print test\Param1
Print test\Param2
|
| ||
| You could create a function to set the type fields, and call it everytime a new type is created. :o) Brilliant. I better he NEVER would have thought of that. Not in a MILLION YEARS. |
| ||
| Halo's at it again! ;) |
| ||
| Haha, well, creating functions for those types would be even more effective. To have those functions call off the Variable itself. Instead of
MyType.CusType = CusType_Create('argu')
CusType_DoStuff(MyType, 'argu')
i Would like
MyType = New CusType('argu')
MyType.DoStuff('argu')
And it have an interal constructor that u can code into and fucntions u can code directly under the type. Also, though i figured ways around it, but say u have a varible that all your types use. It'll be nice if u wouldn't have to know the exact object type to create the object and get the value. So u can jsut busted Things = New CusType Stuff = New AnotherType Function DoStuff( This'Any Type', That'Any Type)) This.GenericVar = That.GenericFunction( This.GenericVar ) End Fucntion DoStuff(Things, Stuff) I wish they had pointers and function pointers in blitz3d. haha, heck, i wish alot of stuff from C++ was in blitz3d. like ++ and --, **, all that sweetness. That's about it tho. The rest of C++ is a mess. haha. |
| ||
| also other things like "+=" "-=" "/=" and a couple others. agreed. |