|
|
#11 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008
Location: Sweden
Posts: 1,671
Reputation: 969
|
Well, if you did use a generic tag for instances instead of the class it would solve some problems.
For example, you could create operators for assigning a value tagged "Instance:" to both floats and ints seamlessly. The only downside would be functions can't be strict on what type of instance they want. |
|
|
|
|
|
#12 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,338
Reputation: 1911
|
That is a very good thought!
|
|
|
|
|
|
#13 |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
I'm finally learning about OOP (It's quite simple... no idea why I avoided it before assuming it was complex)
I just want to confirm a bit how this would be used in Pawn/SA:MP. So for instance, I have some simple Create/Destroy script (Like objects (models, not OOP objects)) would it go something like this: pawn Code:
Sorry for all the questions, I'm probably just thinking too far out the box! I'm kind of new to OOP and I'm not entirely sure how you do these things! But for all I know it could be possible, you've done some pretty good things with Pawn that I would never have thought to be possible ![]() And I'm glad I understand how OOP/Classes work now, I can appreciate this even more! |
|
|
|
|
|
#14 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,338
Reputation: 1911
|
Yes, but there's no "extends" currently - I can't think of a way to do that at all. The closest there is would be membership instead.
|
|
|
|
|
|
#15 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,338
Reputation: 1911
|
I'm moving some files about so I thought I would post what little code I had written ages ago here:
pawn Code:
The commented stuff at the end (IIRC) does actually work, but I can't remember what I was doing at the minute. The "CTest" "class" is currently expanded and contains the code that the macros should end up with. |
|
|
|
|
|
#16 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2009
Location: The Polish guy in The Netherlands
Posts: 2,299
Reputation: 286
|
this stuff is very cool, but isn't it -by the time you create all this - easier/faster to just make a custom compiler which generates sa-mp compatible output(amx) (while maintaining compatibility with current scripts)?
SA-MP won't change the pawn version anymore, At least I think so. I have a failed attempt at a custom pre-processor.. but it's not a compiler so there is a difference. |
|
|
|
|
|
#17 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,338
Reputation: 1911
|
A compiler is A LOT of work - serious amounts! I would have liked to have written an LLVM front/back end for PAWN/P-code, but don't have the time.
|
|
|
|
|
|
#18 | |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2009
Location: The Polish guy in The Netherlands
Posts: 2,299
Reputation: 286
|
Quote:
I read about LLVM on wiki but I still don't understand it. What's it all about? Standalone compiler or something that generates some output and passes the remaining stuff onto the original compiler? |
|
|
|
|
|
|
#19 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2012
Location: Germany
Posts: 1,145
Reputation: 5
|
That is nice.
|
|
|
|
|
|
#20 |
|
Gangsta
![]() ![]() ![]() ![]() Join Date: Feb 2010
Location: Germany
Posts: 634
Reputation: 44
|
This looks nice
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Certain Classes? | jameskmonger | Help Archive | 3 | 13/04/2010 08:48 PM |
| I need Classes | XxJoexX | Help Archive | 17 | 14/03/2010 04:30 PM |
| [HELP]Classes | txraptor | Help Archive | 0 | 29/12/2009 02:11 PM |
| ysf and npc classes | Jason_Borne420 | Help Archive | 1 | 17/10/2009 11:01 PM |