Raised This Month: $51 Target: $400
 12% 

View Poll Results: What would you class the compile error as?
A bug 0 0%
Not suppose to happen. 3 60.00%
It's works as it should. 2 40.00%
Voters: 5. You may not vote on this poll

Would this count as either a compiler bug/not intended result/or as expected?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 01-05-2016 , 14:46   Would this count as either a compiler bug/not intended result/or as expected?
Reply With Quote #1

Below was just out of curiosity:
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo = {
    
name        "",
    
author      "",
    
description "",
    
version     "0.0.0",
    
url         ""
};

int t 5;

methodmap Test1
{
    
property int X
    
{
        public 
get() { return t; }
    }
}

methodmap Test2 Test1
{
    
property int X
    
{
        public 
set(int value) { value; }
    }
}

public 
void OnPluginStart()
{
    
Test2 x;
    
int xt x.X;

Compiler says:
PHP Code:
SourcePawn Compiler 1.8.0-dev+5439
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2015 AlliedModders LLC

plugin
.sp(35) : error 149no getter found for property X

1 Error

So would ^ count as a compiler bug/not intended(aka NOT suppose to happen)/or working as it should?

Note: Adding the get statement into Test2 does remove compile error.

Edit: This does provide some basic polymorphism on methodmap properties.
Edit2: It seems it also will work on normal methods(non-properties) in methodmaps.

Last edited by WildCard65; 01-05-2016 at 15:02.
WildCard65 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-05-2016 , 17:43   Re: Would this count as either a compiler bug/not intended result/or as expected?
Reply With Quote #2

I think your overriding X and removing the getter when you do.
__________________
Neuro Toxin is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-06-2016 , 15:35   Re: Would this count as either a compiler bug/not intended result/or as expected?
Reply With Quote #3

Quote:
Originally Posted by Neuro Toxin View Post
I think your overriding X and removing the getter when you do.
Yes, that's exactly what's happening.
__________________
asherkin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode