What is the correct syntax to create and assign a byte array in 9.2?

View: New views
3 Messages — Rating Filter:   Alert me  

What is the correct syntax to create and assign a byte array in 9.2?

by romannk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Forgive me if I am being a little thick. I have some code along the
lines of

b = array(byte,(123,234,123))

 to declare and initialise an array of bytes.

This is now flagged by the compiler -  WARNING:
'Boo.Lang.Builtins.array(System.Type, System.Collections.ICollection)'
is obsolete.

I had a look at   BOO-1203 but it isn't clear to me exactly how to
translate

dataBytes = array[of byte](some_byte_enumerable)

 into something suitable for this situation that is suitably wrist
friendly.

Could someone point me in the right direction please?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: What is the correct syntax to create and assign a byte array in 9.2?

by Cedric Vivier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

On Thu, Sep 17, 2009 at 9:28 AM, romannk <romann@...> wrote:
b = array(byte,(123,234,123))
 to declare and initialise an array of bytes.

This is now flagged by the compiler -  WARNING:
'Boo.Lang.Builtins.array(System.Type, System.Collections.ICollection)'
is obsolete.


This warning will not be shown when array(Type, ICollection) signature will be removed in next release, the array(Type, IEnumerable) being still available this is a source-compatible change.

 
I had a look at          BOO-1203 but it isn't clear to me exactly how to
translate

dataBytes = array[of byte](some_byte_enumerable)



Since you initialize your array with another literal array, you could use :
b = array[of byte]((of byte: 123,234,123))

Which makes obvious that the array declaration is actually not needed at all since you already use a literal array,
so you can cut it to only :
b = (of byte: 123, 234, 123)


Cheers,


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: What is the correct syntax to create and assign a byte array in 9.2?

by romannk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thank you Cedric for your speedy and informative reply. Just what I
wanted, works a treat.

On Sep 17, 3:12 pm, Cedric Vivier <cedr...@...> wrote:

> Hey,
>
> On Thu, Sep 17, 2009 at 9:28 AM, romannk <rom...@...> wrote:
> > b = array(byte,(123,234,123))
> >  to declare and initialise an array of bytes.
>
> > This is now flagged by the compiler -  WARNING:
> > 'Boo.Lang.Builtins.array(System.Type, System.Collections.ICollection)'
> > is obsolete.
>
> This warning will not be shown when array(Type, ICollection) signature will
> be removed in next release, the array(Type, IEnumerable) being still
> available this is a source-compatible change.
>
> > I had a look at          BOO-1203 but it isn't clear to me exactly how to
> > translate
>
> > dataBytes = array[of byte](some_byte_enumerable)
>
> Since you initialize your array with another literal array, you could use :
> b = array[of byte]((of byte: 123,234,123))
>
> Which makes obvious that the array declaration is actually not needed at all
> since you already use a literal array,
> so you can cut it to only :
> b = (of byte: 123, 234, 123)
>
> Cheers,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Boo Programming Language" group.
To post to this group, send email to boolang@...
To unsubscribe from this group, send email to boolang+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/boolang?hl=en
-~----------~----~----~----~------~----~------~--~---