Jump to content
  • Advertisement
  • entries
  • comments
  • views

Tangent: this-properties

Sign in to follow this  


Just a little work today. I implemented something mildly weird. For those familiar with C++, Tangent supports a form of operator(). It's something like:

public class foo{
public this()=>void{
print "foo!";

public static main()=>void{
local foo aFoo = new foo;


And it's used for the normal sort of functor stuff that C++ uses it for.

What I implemented today was a similar beast for properties:

public class intProperty{
private int x;

public int this{
x = value;

public static main()=>void{
local intProperty x = new intProperty;

x = 5;
print x;

Not very thrilling. Eventually though, I want to use this mechanism to create stuff like reusable properties that have an event that is triggered when the setter is called. It'll also be used for things often relegated to implicit conversions.

I need to figure out a good way to allow the programmer to disambiguate member access on the property rather than it's value member access, but that's not a huge priority. I don't expect that scenario to arise often.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!