잊지 않겠습니다.

What are the things you need to remember to make your code interoperable between language?

Common language specification complicance isn't the default

Operation overload : not Common Language Specification(CLS)

CLS-Compliant : add [Assembly:system.CLSCompliant(true)] 를 넣어줘야지 된다.

이는 Language가 다를때, 서로간에 CLS에 대해서 명확한 정의를 따르는지에 대한 Compiler level에서의 정의가 될 수 있다.

 

Optional parameters break interoperability

VB.NET에서 허용되는 option parameter의 경우에는 C#에서는 허용되지 않기 때문에, 반드시 그 값을 적어줘야지 된다.

 

Mixing case between class members breaks interoperability

VB.NET에서는 각 값의 case에 따라서 다른 Property, member, method를 가질 수 있다. 이는 VB.NET과 C#을 섞어서 사용하는 경우에 CLS를 위반하게 된다.

 

Name collision with keywords breaks interoperability

VB.NET에서 사용되는 Stop()의 경우에는 code break로 사용되기 때문에, 이름에 의한 충돌이 일어날 수 있다. 언어의 종류에 따라 method의 이름을 명명할 때 주의해야지 된다. 

 

Defining an array isn't interoperability

VB에서 자주 일어나던 문제. VB의 경우에는 Array의 크기의 선언이 아닌 Array의 max index의 선언이기 때문에 발생

int[] intDatas = new int[3]; <- size : 3
Dim intDatas() As Integer = new Integer(3) {} <- size : 4


Posted by Y2K
,