comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » It seems that there is *a bit* polymorphism in IDL.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
It seems that there is *a bit* polymorphism in IDL. [message #40464] Wed, 11 August 2004 04:00 Go to previous message
tianyf is currently offline  tianyf
Messages: 6
Registered: June 2004
Junior Member
I don't know if someone had ever noticed that what will happen if the
procedure and the function have the same name. My conclusion is that
IDL can figure out which one I am calling - the procedure or the
function. This may be a bit useful in some cases. Let's take a look at
the following example.

;+
; Name:
; msgbox
;
; Purpose:
; Another form of DIALOG_MESSAGE.
;
; Type:
; Function/Procedure
;
; Description:
; This is a mixed routine which has the same name for function
; and procedure. When called, it can distinguish which one is
; called. However, IDL cannot handle functions with the same
; name but with differenct number or type of parameters.
;
;-
;This is the procedure.
pro msgbox, text, _extra=_extra_
if n_params() lt 1 then text='Hello, the world!'
dummy=dialog_message(text,_extra=_extra_)
end
;
;This is the function.
function msgbox, text, _extra=_extra_
if n_params() lt 1 then text='Hello, the world!'
dummy=dialog_message(text,_extra=_extra_)
return,dummy
end


Tian.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multiple IDL versions
Next Topic: black window on fsc_surface & fsc_surface_log?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 11:23:34 PDT 2025

Total time taken to generate the page: 1.27918 seconds