Re: [Gambas-user] Array.Sort

2015-01-08 Thread Tobias Boege
On Wed, 07 Jan 2015, Lewis Balentine wrote:
> Do I have it correct now ??
> The program runs and operates as expected.
> My concern is more to the proper nomenclature than function.
> 

Array.Sort() is a *method* :-)

It rearranges the elements of the object it is applied to and returns that
object afterwards. That is, you will always have

  aArray == aArray.Sort()

where == should be read as "are the same object", despite == not being a
Gambas operator (I use it here to distinguish between the same-object
relation and an assignment).

So, the actual work is done on the object you use to the method on and the
return value is just for brevity in certain applications like

  Print aArray.Sort().Join(",")

  ' or

  For Each sElt In aArray.Sort()
Print sElt
  Next

  ' or

  With EliminateSuccessiveDuplicates(aArray.Sort())
Print .Count;; "unique elements:"
For iInd = 0 To .Max
  Print .[iInd]
Next
  End With

If you want truly function-like semantics, then you can use the idiom

  aArray.Copy().Sort()

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] [CRASH REPORT] TestApp01

2015-01-08 Thread Karl Reinl
Hello,

Damned, my program crashed Gambas that way :

after con is declared (pass it with F8), then dblClick con to inspect it.




TestApp01-0.0.1-crash-150108-194725.tar.bz2
Description: application/bzip-compressed-tar
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] [CRASH REPORT] TestApp01

2015-01-08 Thread Jussi Lahtinen
The attachment doesn't contain any sources..?
Use IDE to package the sources; Project --> Make --> Source archive.


Jussi

On Thu, Jan 8, 2015 at 8:49 PM, Karl Reinl  wrote:

> Hello,
>
> Damned, my program crashed Gambas that way :
>
> after con is declared (pass it with F8), then dblClick con to inspect it.
>
>
>
>
> --
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] [CRASH REPORT] TestApp01

2015-01-08 Thread Charlie Reinl
Am Donnerstag, den 08.01.2015, 20:57 +0200 schrieb Jussi Lahtinen:
> The attachment doesn't contain any sources..?
> Use IDE to package the sources; Project --> Make --> Source archive.
> 
> 
> Jussi
> 
> On Thu, Jan 8, 2015 at 8:49 PM, Karl Reinl  wrote:
> 
> > Hello,
> >
> > Damned, my program crashed Gambas that way :
> >
> > after con is declared (pass it with F8), then dblClick con to inspect it.
> >


Ok, another bug, I checked for sending the source also.

But no matters, just declare 
Dim con As New Connection 

After passing that line, inspect con by DBLClick 


-- 
Amicalement
Charlie


TestApp01-0.0.1.tar.gz
Description: application/compressed-tar
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] [CRASH REPORT] TestApp01

2015-01-08 Thread Karl Reinl
Hello,

Damned, my program crashed Gambas that way :

the try con.Open fails when only the con.name is filled

Sorry for last CRASH-Report,  I checked for not sending source.




TestApp01-0.0.1-crash-150108-211425.tar.bz2
Description: application/bzip-compressed-tar
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] [CRASH REPORT] TestApp01

2015-01-08 Thread Jussi Lahtinen
OK, I can confirm, it crashes with my system too.

[System]
Gambas=3.6.90
OperatingSystem=Linux
Kernel=3.13.0-43-generic
Architecture=x86_64
Distribution=Ubuntu 14.04.1 LTS
Desktop=XFCE
Theme=QGtk
Language=en_US.UTF-8
Memory=3953M
[Libraries]
Cairo=libcairo.so.2.11301.0
Curl=libcurl.so.4.3.0
DBus=libdbus-1.so.3.7.6
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.204.0
GTK+3=libgtk-3.so.0.1000.8
GTK+=libgtk-x11-2.0.so.0.2400.23
OpenGL=libGL.so.1.2.0
Poppler=libpoppler.so.44.0.0
Qt4=libQtCore.so.4.8.6
SDL=libSDL-1.2.so.0.11.4


Jussi

On Thu, Jan 8, 2015 at 10:17 PM, Karl Reinl  wrote:

> Hello,
>
> Damned, my program crashed Gambas that way :
>
> the try con.Open fails when only the con.name is filled
>
> Sorry for last CRASH-Report,  I checked for not sending source.
>
>
>
>
> --
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Array.Sort

2015-01-08 Thread Lewis Balentine
On 01/08/2015 07:19 AM, Tobias Boege wrote:
> Array.Sort() is a *method* :-)

The basic (pun intended) elements of all OOP languages are classes 
constructed of properties and methods.
--- you got me on that one

In GAMBAS there seem to be several class methods defined that sometimes 
require parenthesis and sometimes do not. I was trying to 
determine/define the conditions that delimit when those parenthesis are 
required using familiar BASIC terms ... as in:
 Public/Private Function  foo () as data type
 Public/Private Sub  foo ()
both of which I believe are appropriately considered methods in OOP 
languages.

I believe my second formal computer class was MBASIC on a Osborn CPM 
computer (4 inch green screen). I am trying to recall if the term 
"Function" was defined in that language but those gray cells are no 
longer responding reliably. The other option was "Go to" that eventually 
evolved into "Public/Private Sub". At the time we called those 
"procedures".  I still call them "procedures" to distinguish them from a 
"function" that by definition is supposed to return something.

Take a look at what I put in the WiKi and let me know if I should change it.
http://gambaswiki.org/wiki/comp/gb/string[]/sort
... and if someone insists I will go back and change the variables to 
Hungarian notation but personally I find it more confusing than enlighting.

Cheers,

Lewis



--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Array.Sort

2015-01-08 Thread Benoît Minisini
Le 09/01/2015 00:56, Lewis Balentine a écrit :
> On 01/08/2015 07:19 AM, Tobias Boege wrote:
>> Array.Sort() is a *method* :-)
>
> The basic (pun intended) elements of all OOP languages are classes
> constructed of properties and methods.
> --- you got me on that one
>
> In GAMBAS there seem to be several class methods defined that sometimes
> require parenthesis and sometimes do not. I was trying to
> determine/define the conditions that delimit when those parenthesis are
> required using familiar BASIC terms ... as in:
>   Public/Private Function  foo () as data type
>   Public/Private Sub  foo ()
> both of which I believe are appropriately considered methods in OOP
> languages.
>
> I believe my second formal computer class was MBASIC on a Osborn CPM
> computer (4 inch green screen). I am trying to recall if the term
> "Function" was defined in that language but those gray cells are no
> longer responding reliably. The other option was "Go to" that eventually
> evolved into "Public/Private Sub". At the time we called those
> "procedures".  I still call them "procedures" to distinguish them from a
> "function" that by definition is supposed to return something.
>
> Take a look at what I put in the WiKi and let me know if I should change it.
> http://gambaswiki.org/wiki/comp/gb/string[]/sort
> ... and if someone insists I will go back and change the variables to
> Hungarian notation but personally I find it more confusing than enlighting.
>
> Cheers,
>
> Lewis
>

It's simple:

You can omit the "()" at the end of function call statement only. It's a 
compiler shortcut that comes from Visual Basic.

I said "statement", not "procedure", because the interpreter makes no 
difference between a procedure (that returns nothing) and a function 
(that returns something) in the sense that it discovers that behaviour 
at runtime during the execution ; contrary to you, that knows that in 
advance.

Regards,

-- 
Benoît Minisini

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Array.Sort

2015-01-08 Thread T Lee Davidson
"The empty set of parentheses is REQUIRED when sort is used as a function to 
return an array without the optional mode parameter"

I don't know. Wouldn't it be more accurate to say that the parentheses are 
required to be able to use the function call as the object which it 
returns; as opposed to the syntax, without the parentheses, referring to the 
function itself?


Lee
__

"Artificial Intelligence is no match for natural stupidity."

On 01/08/2015 06:56 PM, Lewis Balentine wrote:
> On 01/08/2015 07:19 AM, Tobias Boege wrote:
>> Array.Sort() is a *method* :-)
>
> The basic (pun intended) elements of all OOP languages are classes
> constructed of properties and methods.
> --- you got me on that one
>
> In GAMBAS there seem to be several class methods defined that sometimes
> require parenthesis and sometimes do not. I was trying to
> determine/define the conditions that delimit when those parenthesis are
> required using familiar BASIC terms ... as in:
>   Public/Private Function  foo () as data type
>   Public/Private Sub  foo ()
> both of which I believe are appropriately considered methods in OOP
> languages.
>
> I believe my second formal computer class was MBASIC on a Osborn CPM
> computer (4 inch green screen). I am trying to recall if the term
> "Function" was defined in that language but those gray cells are no
> longer responding reliably. The other option was "Go to" that eventually
> evolved into "Public/Private Sub". At the time we called those
> "procedures".  I still call them "procedures" to distinguish them from a
> "function" that by definition is supposed to return something.
>
> Take a look at what I put in the WiKi and let me know if I should change it.
> http://gambaswiki.org/wiki/comp/gb/string[]/sort
> ... and if someone insists I will go back and change the variables to
> Hungarian notation but personally I find it more confusing than enlighting.
>
> Cheers,
>
> Lewis
>
>
>
> --
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Array.Sort

2015-01-08 Thread Benoît Minisini
Le 09/01/2015 01:09, T Lee Davidson a écrit :
> "The empty set of parentheses is REQUIRED when sort is used as a function to 
> return an array without the optional mode parameter"
>
> I don't know. Wouldn't it be more accurate to say that the parentheses are 
> required to be able to use the function call as the object which it
> returns; as opposed to the syntax, without the parentheses, referring to the 
> function itself?
>
>
> Lee

Why not just say that?

« You can omit the "()" at the end of a function or method call 
statement only. If you don't understand the previous sentence, always 
use "()" to call a function or a method. »

:-)

-- 
Benoît Minisini

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Array.Sort

2015-01-08 Thread T Lee Davidson
On 01/08/2015 07:12 PM, Benoît Minisini wrote:
> Le 09/01/2015 01:09, T Lee Davidson a écrit :
>> "The empty set of parentheses is REQUIRED when sort is used as a function to 
>> return an array without the optional mode parameter"
>>
>> I don't know. Wouldn't it be more accurate to say that the parentheses are 
>> required to be able to use the function call as the object which it
>> returns; as opposed to the syntax, without the parentheses, referring to the 
>> function itself?
>>
>>
>> Lee
>
> Why not just say that?
>
> « You can omit the "()" at the end of a function or method call
> statement only. If you don't understand the previous sentence, always
> use "()" to call a function or a method. »
>
> :-)
>

Somehow simple always seems to promote clarity. But, I'll leave it to Lewis to 
edit his edit. :-)

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Array.Sort

2015-01-08 Thread adamn...@gmail.com
On Fri, 09 Jan 2015 01:12:50 +0100
Benoît Minisini  wrote:

> Le 09/01/2015 01:09, T Lee Davidson a écrit :
> > "The empty set of parentheses is REQUIRED when sort is used as a function 
> > to return an array without the optional mode parameter"
> >
> > I don't know. Wouldn't it be more accurate to say that the parentheses are 
> > required to be able to use the function call as the object which it
> > returns; as opposed to the syntax, without the parentheses, referring to 
> > the function itself?
> >
> >
> > Lee
> 
> Why not just say that?
> 
> « You can omit the "()" at the end of a function or method call 
> statement only. If you don't understand the previous sentence, always 
> use "()" to call a function or a method. »
> 
> :-)
> 

I would have thought that the issue is "the other way up", viz:

If any class method is used as the predicate of an assignment or as the implied 
object of a command, then the parentheses "()" must be included, even if any or 
all (optional) method parameters are not specified. The parentheses "()" may be 
left out if the method is used purely to manipulate the internal state of the 
object (whether or not that method may return a value).

Examples
Consider a hypothetical class method "Negate" that inverts the value of some 
attribute of the object and returns that value. Thus the "()" is required for:
SomeLocalVar = MyObject.Negate()
Print MyObject.Negate()
but
MyObject.Negate
is perfectly legal. In this case the value is inverted but the result is 
"thrown away" by the interpreter.

I cannot think of any exceptions to this.

regards
Bruce

-- 
B Bruen 

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Issue 589 in gambas: Interpreter Crash Gambas3 - Calling a library function - BananaPi

2015-01-08 Thread gambas

Comment #5 on issue 589 by scrcarl...@gmail.com: Interpreter Crash Gambas3  
- Calling a library function - BananaPi
https://code.google.com/p/gambas/issues/detail?id=589

Dear Benoit,

to be honest, I have reached a point where I have to make a decision if to  
continue with Gambas 3 or not. The problem is exactly this function  
PMD_Find_Interface().
Its function prototype is PMD_Find_Interface (HIDInterface** hid, int  
interface, int productID). HIDInterface is a structure with a lenght of 52  
bytes.
The problen is how to code it in Gambas:
1.) HIDInterface* hid(7);  how to transscribe this in Gambas
2.) interface = PMD_Find_Inteface ( &hid[i], i, USB1608FS_PID); how to  
setup this call

So I have to establish a construct of 7 memory blocks which are accessed by  
pointers each. I am not interested in the content of these blocks, I only  
have to transfer it from one function to an other by hid[].
If this can not be done by Gambas 3 I have to stop all activities and have  
to look for other IDEs. In the past I have developped many testprograms  
under VB6, therefore I came to Gambas3. In my test setups I have to adress  
many test equipment via USB in many cases on low level.

-- 
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user