PlatformFunction omits check for invalid parameter types when using class method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

PlatformFunction omits check for invalid parameter types when using class method

jtuchel
Hi there,

I've just spent a little time searching for a proplem with calling an external function that has no parameters.

The problem was that I used

PlatformFunction callingConvention:  'c' function: 'MyExternalCall' library:  'myDll' parameterTypes:  #(void) returnType: #pointer

instead of

PlatformFunction 
   callingConvention:  'c' 
   function: 'MyExternalCall' 
   library:  'myDll' 
   parameterTypes:  #() 
   returnType: #pointer


The funny thing is that VA has impelemented a check for none and void as invalid parameter taypes, but it is never called by the above mentioned class method. So I think there are two things that can be improved in upcoming versions of VAST:
  • make sure PlatformFunction class>>#isValidParameterType: is used in PlatformFunction class>>#callingConvention:function:library:parameterTypes:returnType:
  • Improve teh message  (NlsCatKRN indexedMsg: 26). It should say something like: The Platfform function cannot be defined because %1 is an invalid parameter type. Now it just says 'invalid parameter type'. This doesn't clearly state where the user has problems. It could be at definition or call time

For a more detailed description you can look here: http://joachimtuchel.wordpress.com/2013/12/16/va-smalltalk-8-6-and-external-calls-with-no-parameter/


HTH,

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: PlatformFunction omits check for invalid parameter types when using class method

John O'Keefe-3
Joachim -

There are 3 classes that should be updated with improved checking/diagnostic messages:  PlatformFunction, EsAPIType, and EsEntryPoint.

Replacement messages could be something like this:
  • 'invalid calling convention'  -->  '%1 is not a valid calling convention'
  • 'invalid parameter type'  -->  '%1 is not a valid parameter type'
  • 'invalid parameter type'  -->  '%1 is not a valid return type'  "there was not a separate message for this"
  • 'invalid conversion type'  -->  '%1 is not a valid conversion type'
  • 'wrong number of parameters'  -->  'Wrong number of parameters - expected %1, but got %2'
What do you think?

On Monday, December 16, 2013 4:15:44 AM UTC-5, [hidden email] wrote:
Hi there,

I've just spent a little time searching for a proplem with calling an external function that has no parameters.

The problem was that I used

PlatformFunction callingConvention:  'c' function: 'MyExternalCall' library:  'myDll' parameterTypes:  #(void) returnType: #pointer

instead of

PlatformFunction 
   callingConvention:  'c' 
   function: 'MyExternalCall' 
   library:  'myDll' 
   parameterTypes:  #() 
   returnType: #pointer


The funny thing is that VA has impelemented a check for none and void as invalid parameter taypes, but it is never called by the above mentioned class method. So I think there are two things that can be improved in upcoming versions of VAST:
  • make sure PlatformFunction class>>#isValidParameterType: is used in PlatformFunction class>>#callingConvention:function:library:parameterTypes:returnType:
  • Improve teh message  (NlsCatKRN indexedMsg: 26). It should say something like: The Platfform function cannot be defined because %1 is an invalid parameter type. Now it just says 'invalid parameter type'. This doesn't clearly state where the user has problems. It could be at definition or call time

For a more detailed description you can look here: <a href="http://joachimtuchel.wordpress.com/2013/12/16/va-smalltalk-8-6-and-external-calls-with-no-parameter/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjoachimtuchel.wordpress.com%2F2013%2F12%2F16%2Fva-smalltalk-8-6-and-external-calls-with-no-parameter%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNE-PgbHge-2-EiYhmK8sMHf25bKNg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjoachimtuchel.wordpress.com%2F2013%2F12%2F16%2Fva-smalltalk-8-6-and-external-calls-with-no-parameter%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNE-PgbHge-2-EiYhmK8sMHf25bKNg';return true;">http://joachimtuchel.wordpress.com/2013/12/16/va-smalltalk-8-6-and-external-calls-with-no-parameter/


HTH,

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: PlatformFunction omits check for invalid parameter types when using class method

jtuchel
John,

sounds very good to me. 

I initially thought it would be a good idea to include some info on the fact that the error appeared when defining the function, just to make sure you don't search for problems related to something outside the image. OTOH, you can see that in a walkback anyways. So I am still not sure it wouldn't be better, but maybe I am overseeing that the same messages are used at call time as well...

Thanks for looking into this. It is not an urgent or bad problem, but the changes you suggest make life a lot easier, especially for people who are not C programmers with a passion...

Joachim

Am Dienstag, 17. Dezember 2013 20:55:35 UTC+1 schrieb John O'Keefe:
Joachim -

There are 3 classes that should be updated with improved checking/diagnostic messages:  PlatformFunction, EsAPIType, and EsEntryPoint.

Replacement messages could be something like this:
  • 'invalid calling convention'  -->  '%1 is not a valid calling convention'
  • 'invalid parameter type'  -->  '%1 is not a valid parameter type'
  • 'invalid parameter type'  -->  '%1 is not a valid return type'  "there was not a separate message for this"
  • 'invalid conversion type'  -->  '%1 is not a valid conversion type'
  • 'wrong number of parameters'  -->  'Wrong number of parameters - expected %1, but got %2'
What do you think?

On Monday, December 16, 2013 4:15:44 AM UTC-5, [hidden email] wrote:
Hi there,

I've just spent a little time searching for a proplem with calling an external function that has no parameters.

The problem was that I used

PlatformFunction callingConvention:  'c' function: 'MyExternalCall' library:  'myDll' parameterTypes:  #(void) returnType: #pointer

instead of

PlatformFunction 
   callingConvention:  'c' 
   function: 'MyExternalCall' 
   library:  'myDll' 
   parameterTypes:  #() 
   returnType: #pointer


The funny thing is that VA has impelemented a check for none and void as invalid parameter taypes, but it is never called by the above mentioned class method. So I think there are two things that can be improved in upcoming versions of VAST:
  • make sure PlatformFunction class>>#isValidParameterType: is used in PlatformFunction class>>#callingConvention:function:library:parameterTypes:returnType:
  • Improve teh message  (NlsCatKRN indexedMsg: 26). It should say something like: The Platfform function cannot be defined because %1 is an invalid parameter type. Now it just says 'invalid parameter type'. This doesn't clearly state where the user has problems. It could be at definition or call time

For a more detailed description you can look here: <a href="http://joachimtuchel.wordpress.com/2013/12/16/va-smalltalk-8-6-and-external-calls-with-no-parameter/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjoachimtuchel.wordpress.com%2F2013%2F12%2F16%2Fva-smalltalk-8-6-and-external-calls-with-no-parameter%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNE-PgbHge-2-EiYhmK8sMHf25bKNg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjoachimtuchel.wordpress.com%2F2013%2F12%2F16%2Fva-smalltalk-8-6-and-external-calls-with-no-parameter%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNE-PgbHge-2-EiYhmK8sMHf25bKNg';return true;">http://joachimtuchel.wordpress.com/2013/12/16/va-smalltalk-8-6-and-external-calls-with-no-parameter/


HTH,

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

REST support in VASmalltalk

SebastianHC
Hi!

more and more I am in need of REST support in VASmalltalk.
Are there any solutions out there?

Did anybody port the Seaside-REST Tools/Browsers to VAST?
I simply have a hard time to work with Pragmas without proper tooling...

Thanks and have Great Holidays!
Sebastian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: REST support in VASmalltalk

Marten Feldtmann-2
Yes, same here. After working with Gemstone over the last weeks and with the Zinc Http server and REST tools (and WebSockets) I know what I will be missing at the VA platform.

During these dark days (winter !) I sometimes even think about porting the whole Zinc stuff to VA to have a full HTTP server without any restrictions.

Marten

Am Mittwoch, 18. Dezember 2013 18:30:56 UTC+1 schrieb Sebastian Heidbrink:
Hi!

more and more I am in need of REST support in VASmalltalk.
Are there any solutions out there?

Did anybody port the Seaside-REST Tools/Browsers to VAST?
I simply have a hard time to work with Pragmas without proper tooling...

Thanks and have Great Holidays!
Sebastian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: REST support in VASmalltalk

SebastianHC
Does Zinc make sense on VAST? I mean we have SST,...?
Did you already investigate a little further into this?

Sebastian

Am 18.12.2013 09:39, schrieb Marten Feldtmann:
Yes, same here. After working with Gemstone over the last weeks and with the Zinc Http server and REST tools (and WebSockets) I know what I will be missing at the VA platform.

During these dark days (winter !) I sometimes even think about porting the whole Zinc stuff to VA to have a full HTTP server without any restrictions.

Marten

Am Mittwoch, 18. Dezember 2013 18:30:56 UTC+1 schrieb Sebastian Heidbrink:
Hi!

more and more I am in need of REST support in VASmalltalk.
Are there any solutions out there?

Did anybody port the Seaside-REST Tools/Browsers to VAST?
I simply have a hard time to work with Pragmas without proper tooling...

Thanks and have Great Holidays!
Sebastian
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: REST support in VASmalltalk

jtuchel
Hi Sebastian, Hi Marten,

I too sometimes wonder if Zinc on VAST would be a good thing to have. On the other hand, SST is very stable and effective. I am not sure the effort of porting it would be worth it. SST may need some refreshing in a few corners, but I know Instantiations has an eye on that. The main argument for Zinc is probably the fact that it is sure is more lightweight and probably supports more of the newer standards, like WebSockets. WebSockets would be a dream...

Processing REST requests with SST is very easy. I have done it in the 2008/2009 time frame and also gave a few presentations about it. You may want to take a look at slides 43 and 44 of this slide deck: http://www.objektfabrik.de/Downloads/VASTSummit2009/VAST_RESTful_WS.html. You can see there that you only have to override a hand full of classes to handle REST requests. 

In my opinion, Seaside-REST has to weak points:
* It misuses method pragmas as a naming service. This is hard to maintain with current smalltalk browsers and also makes little sense. The name/url of a request handler should either be something that you configure or set in code (both do not exclude each other), but not be put in some special bucket that's embedded in the source code.
* REST is very low level. Just responding to HTTP requests. Putting this on top of Seaside is like building a car that includes an aircraft carrier. You burn quite a lot of CPU cycles for little gain - not something I wish to do in a single-OS-process system with green threads...

I will see if I find the time to brush off the dust from my old pRESTon code and make it available. Don't expect this to happen all too fast at this time of the year, however.

Joachim


Am Mittwoch, 18. Dezember 2013 18:42:35 UTC+1 schrieb Sebastian Heidbrink:
Does Zinc make sense on VAST? I mean we have SST,...?
Did you already investigate a little further into this?

Sebastian

Am 18.12.2013 09:39, schrieb Marten Feldtmann:
Yes, same here. After working with Gemstone over the last weeks and with the Zinc Http server and REST tools (and WebSockets) I know what I will be missing at the VA platform.

During these dark days (winter !) I sometimes even think about porting the whole Zinc stuff to VA to have a full HTTP server without any restrictions.

Marten

Am Mittwoch, 18. Dezember 2013 18:30:56 UTC+1 schrieb Sebastian Heidbrink:
Hi!

more and more I am in need of REST support in VASmalltalk.
Are there any solutions out there?

Did anybody port the Seaside-REST Tools/Browsers to VAST?
I simply have a hard time to work with Pragmas without proper tooling...

Thanks and have Great Holidays!
Sebastian
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="GaUVveSMK68J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">va-smalltalk...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="GaUVveSMK68J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">va-sma...@....
Visit this group at <a href="http://groups.google.com/group/va-smalltalk" target="_blank" onmousedown="this.href='http://groups.google.com/group/va-smalltalk';return true;" onclick="this.href='http://groups.google.com/group/va-smalltalk';return true;">http://groups.google.com/group/va-smalltalk.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.