Aspect oriented programming: Difference between revisions

No edit summary
Line 20:
;Task
The task is to describe or show how, or to what extent, a given programming language implements, or is able to implement or simulate, Aspect Oriented Programming.
 
=={{header|6502 Assembly}}==
The easiest way to do this is by putting every related function into the same file. One important thing to remember is that in 6502 (and most other assembly languages for that matter, unless linkers are involved), the order in which your code is placed implies its memory location. This is not the case in other languages, not even in [[C]].
<lang 6502asm>SwapXY:
pha
txa
pha
tya
 
tax
pla
tay
pla
rts
 
NewLine: ;the above function will be stored in memory above this one.
lda #13
jmp $FFD2 ;PrintChar on Commodore 64</lang>
 
This is somewhat relevant because it lets you abuse fallthrough. If you have a special case of a particular function that you use often, you can easily make that special case its own function by having it load those specific parameters and then "falling through" into the function you're actually running. This helps to reduce call/return penalties while keeping your relevant pieces of code together. Unfortunately, you can only do this once per function, for obvious reasons.
 
<lang 6502asm>NewLine:
LDA #10 ;linefeed
;the PrintChar function is literally below this line, both in a source code sense and a memory layout sense.
 
PrintChar:
;input: A = the ascii code you wish to print to the screen.
;
; unimplemented because it's dependent on the video hardware but you get the idea</lang>
 
 
=={{header|Ada}}==
Line 78 ⟶ 109:
Result : 7
</pre>
 
 
 
 
=={{header|C}}==
1,489

edits