Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Public Sub Command1_Click() Dim v As New VBA#VBVariant(10) List1.AddItem v.intValue & " " & v.hashCode Call Foo(v) List1.AddItem v.intValue & " " & v.hashCode End Sub Public Sub Foo(ByRef v As VBA#VBVariant) List1.AddItem v.intValue & " " & v.hashCode v = New VBA#VBVariant(v.intValue + 10) List1.AddItem v.intValue & " " & v.hashCode ' 'nop you have no chance to use it as a reference type ' End Sub |
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Yes also my idea. Indeed setVal already exists, but private. We simply have to convert it to public.Quoted
Wouldn't it be enough to implement a public "setVal()" method for VBA#Variant?
Jabaco Source |
|
1 |
v = 10
|
Jabaco Source |
|
1 |
v.setval(10)
|
Jabaco Source |
|
1 |
v = new VBVariant(10) |
Jabaco Source |
|
1 |
Dim v as Variant |
Jabaco Source |
|
1 |
Dim v As New Variant |
This post has been edited 1 times, last edit by "OlimilO" (Oct 26th 2009, 2:03pm)
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Quoted
a possible solution would be a Variant wrapper written in jbc rather than in Java.
The wrapper could have let/get properties to change the internal value.
But the compiler should be changed also, to generate another code.
Quoted
When we usethe compiler should generate
Jabaco Source
1v = 10
Jabaco Source
1v.setval(10)
whenever we writethe compiler should do
Jabaco Source
1 Dim v as Variant
Jabaco Source
1 Dim v As New Variant
Source code |
|
1 2 3 4 5 6 7 |
Str(%1) | Conversion.Str(%1) Chr(%1) | Strings.Chr(%1) Val(%1) | Conversion.Val(%1) Asc(%1) | Strings.Asc(%1) MsgBox(%1) | Interaction.MsgBox(%1) Dim %1 As Varaint | Dim %1 As New Variant Open %1 For %2 As %3 | OOpen %1, %2, %3 |
Then we have somethuing equal.Hi,
I am not very familiar with compiler related stuff.
I have looked at that links. I think, you understand something wrong.Quoted
Are you talking about the Backus-Naur-Form?
I don`t mean any code with an operator "|".Quoted
Source code
1 2 3 Str(%1) | Conversion.Str(%1) Chr(%1) | Strings.Chr(%1) Val(%1) | Conversion.Val(%1)
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 |
Option Explicit Private myIVal As Integer Public Property Get iVal() As Integer iVal = myIVal End Property Public Property Let iVal(i As Integer) myIVal = i End Property |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Public Sub Command1_Click() Dim h As New Holder h.iVal = 1 Debug.Print h.iVal Call mySub(h) Debug.Print h.iVal End Sub Private Sub mySub(h As Holder) h.iVal = h.iVal + 1 End Sub |
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Public Sub Command1_Click() Dim s As String s = "a string" Foo s MsgBox s End Sub Sub Foo(ByRef v As Variant) v = v & "test ByRef" End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Public Sub Command1_Click() Dim s 'As String s = "a string" Foo s MsgBox s End Sub Sub Foo(ByRef v As VBVariant) v.setVal v & "test ByRef" End Sub |