Re: [Vala] Preprocessor defines via Meson or valac

2019-12-06 Thread Guillaume Poirier-Morency via vala-list
Those arguments are passed straight to the C compiler.

Le ven. 6 déc. 2019, à 18 h 10, xydarc...@163.com  a
écrit :

> Is that means the args passed to compile_args in dependency would be
> treated as vala_args when vala language is used?
>
> --
> xydarc...@163.com
>
>
> *From:* Guillaume Poirier-Morency via vala-list 
> *Date:* 2019-12-07 01:32
> *To:* Ken Gilmer 
> *CC:* vala-list 
> *Subject:* Re: [Vala] Preprocessor defines via Meson or valac
> If I can suggest a small improvement, you could use the
> declare_dependency mechanism to add the definition only to the targets
> that link against libfuse:
>
>libfuse_dep = dependency('libfuse')
>libfuse26_dep = declare_dependency(dependencies: [libfuse_dep].
>   compile_args: '-
>DFUSE_USE_VERSION=26')
>
>executable('mount', 'mount.c', dependencies: [libfuse26_dep])
>
> Le vendredi 06 décembre 2019 à 07:37 -0800, Ken Gilmer a écrit :
> > Thank you Guillaume!  For reference this line in my meson.build file
> > allowed me to define a preprocessor symbol as desired:
> >
> > add_project_arguments('-DFUSE_USE_VERSION=26', language: 'c')
> >
> >
> > On Thu, Dec 5, 2019 at 11:45 PM Guillaume Poirier-Morency via vala-
> > list  wrote:
> > > Le jeudi 05 décembre 2019 à 22:13 -0800, Ken Gilmer via vala-list a
> > > écrit :
> > > > Hello!
> > > >
> > > > I am trying to bind to libfuse from a Vala program.  I see that
> > > in
> > > > libfuse
> > > > I must specify a define to the version of the API I want to
> > > > use[4].  I read
> > > > the Vala documentation as to how to define a symbol[3].  I see
> > > that
> > > > there
> > > > is documentation in meson for how to add arguments to valac[1]
> > > but
> > > > when I
> > > > set my flag, add_project_arguments('-D FUSE_USE_VERSION=26',
> > > > language:
> > >
> > > Try to split the arguments in two or remove the space between '-D'
> > > and
> > > 'FUSE_USE_VERSION=26'.
> > >
> > > Like mentioned elsewhere, you will have to set language: 'c' for
> > > this
> > > case to work.
> > >
> > > > 'vala'), valac complains that it doesn't recognize the option and
> > > in
> > > > the
> > > > build output panel in Gnome Builder it appears to wrap the
> > > expression
> > > > in
> > > > single quotes.  When run valac directly from the command line and
> > > > sidestep
> > > > meson, it seems that the define is ignored[2]. As a sanity test,
> > > if I
> > > > modify the header to define the value, I get the behavior I want.
> > > >
> > > > My question is, how can I set a preprocessor symbol to a specific
> > > > value via
> > > > Meson or valac?
> > > >
> > > > TIA!
> > > > ken
> > > >
> > > > 1: https://mesonbuild.com/Vala.html <
> > > > https://mesonbuild.com/Vala.html#>
> > > > 2: valac -D FUSE_USE_VERSION=26 --pkg fuse --pkg gobject-2.0 --
> > > pkg
> > > > glib-2.0
> > > > main.vala
> > > > 3: https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
> > > > 4:
> > > >
> > >
> https://github.com/libfuse/libfuse/blob/fuse_2_9_bugfix/include/fuse.h#L16
> > > > ___
> > > > vala-list mailing list
> > > > vala-list@gnome.org
> > > > https://mail.gnome.org/mailman/listinfo/vala-list
> --
> Guillaume Poirier-Morency 
>
> Programmeur analyste en bioinformatique au laboratoire Michael Smith
> Étudiant à la maîtrise en informatique à l'Université de Montréal
>
> Mon blog: https://arteymix.github.io/
> Clé PGP: B1AD6EA5
>
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
>

-- 
Guillaume Poirier-Morency 

Étudiant à la maîtrise en informatique à l'Université de Montréal
Chercheur à l'Institut de recherche en immunologie et en cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Preprocessor defines via Meson or valac

2019-12-06 Thread Guillaume Poirier-Morency via vala-list
If I can suggest a small improvement, you could use the
declare_dependency mechanism to add the definition only to the targets
that link against libfuse:

   libfuse_dep = dependency('libfuse')
   libfuse26_dep = declare_dependency(dependencies: [libfuse_dep]. 
  compile_args: '-
   DFUSE_USE_VERSION=26')

   executable('mount', 'mount.c', dependencies: [libfuse26_dep])

Le vendredi 06 décembre 2019 à 07:37 -0800, Ken Gilmer a écrit :
> Thank you Guillaume!  For reference this line in my meson.build file
> allowed me to define a preprocessor symbol as desired:
> 
> add_project_arguments('-DFUSE_USE_VERSION=26', language: 'c')
> 
> 
> On Thu, Dec 5, 2019 at 11:45 PM Guillaume Poirier-Morency via vala-
> list  wrote:
> > Le jeudi 05 décembre 2019 à 22:13 -0800, Ken Gilmer via vala-list a
> > écrit :
> > > Hello!
> > > 
> > > I am trying to bind to libfuse from a Vala program.  I see that
> > in
> > > libfuse
> > > I must specify a define to the version of the API I want to
> > > use[4].  I read
> > > the Vala documentation as to how to define a symbol[3].  I see
> > that
> > > there
> > > is documentation in meson for how to add arguments to valac[1]
> > but
> > > when I
> > > set my flag, add_project_arguments('-D FUSE_USE_VERSION=26',
> > > language:
> > 
> > Try to split the arguments in two or remove the space between '-D'
> > and
> > 'FUSE_USE_VERSION=26'.
> > 
> > Like mentioned elsewhere, you will have to set language: 'c' for
> > this
> > case to work.
> > 
> > > 'vala'), valac complains that it doesn't recognize the option and
> > in
> > > the
> > > build output panel in Gnome Builder it appears to wrap the
> > expression
> > > in
> > > single quotes.  When run valac directly from the command line and
> > > sidestep
> > > meson, it seems that the define is ignored[2]. As a sanity test,
> > if I
> > > modify the header to define the value, I get the behavior I want.
> > > 
> > > My question is, how can I set a preprocessor symbol to a specific
> > > value via
> > > Meson or valac?
> > > 
> > > TIA!
> > > ken
> > > 
> > > 1: https://mesonbuild.com/Vala.html <
> > > https://mesonbuild.com/Vala.html#>
> > > 2: valac -D FUSE_USE_VERSION=26 --pkg fuse --pkg gobject-2.0 --
> > pkg
> > > glib-2.0
> > > main.vala
> > > 3: https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
> > > 4:
> > > 
> > https://github.com/libfuse/libfuse/blob/fuse_2_9_bugfix/include/fuse.h#L16
> > > ___
> > > vala-list mailing list
> > > vala-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency 

Programmeur analyste en bioinformatique au laboratoire Michael Smith
Étudiant à la maîtrise en informatique à l'Université de Montréal

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Preprocessor defines via Meson or valac

2019-12-05 Thread Guillaume Poirier-Morency via vala-list
Le jeudi 05 décembre 2019 à 22:13 -0800, Ken Gilmer via vala-list a
écrit :
> Hello!
> 
> I am trying to bind to libfuse from a Vala program.  I see that in
> libfuse
> I must specify a define to the version of the API I want to
> use[4].  I read
> the Vala documentation as to how to define a symbol[3].  I see that
> there
> is documentation in meson for how to add arguments to valac[1] but
> when I
> set my flag, add_project_arguments('-D FUSE_USE_VERSION=26',
> language:

Try to split the arguments in two or remove the space between '-D' and
'FUSE_USE_VERSION=26'.

Like mentioned elsewhere, you will have to set language: 'c' for this
case to work.

> 'vala'), valac complains that it doesn't recognize the option and in
> the
> build output panel in Gnome Builder it appears to wrap the expression
> in
> single quotes.  When run valac directly from the command line and
> sidestep
> meson, it seems that the define is ignored[2]. As a sanity test, if I
> modify the header to define the value, I get the behavior I want.
> 
> My question is, how can I set a preprocessor symbol to a specific
> value via
> Meson or valac?
> 
> TIA!
> ken
> 
> 1: https://mesonbuild.com/Vala.html <
> https://mesonbuild.com/Vala.html#>
> 2: valac -D FUSE_USE_VERSION=26 --pkg fuse --pkg gobject-2.0 --pkg
> glib-2.0
> main.vala
> 3: https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
> 4:
> https://github.com/libfuse/libfuse/blob/fuse_2_9_bugfix/include/fuse.h#L16
> _______
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency 

Programmeur analyste en bioinformatique au laboratoire Michael Smith
Étudiant à la maîtrise en informatique à l'Université de Montréal

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Downloading only a portion in the latter part of a file from internet

2019-08-28 Thread Guillaume Poirier-Morency via vala-list
Your code is problematic: skipping the DataInputStream does not guarantee
you that the underlying FileInputStream will be positioned at the desired
byte offset when skipped. This is due to the buffering.

If you are to operate on your stream via a DataInputStream, use it
exclusively:

var dis = DataInputStream(file_stream)
dis.skip(80);

uint8 buffer[160];

size_t buffer_len;

dis.read_all(buffer, out buffer_len);


Alternatively, you should consider an HTTP range query, which will allow
you to do the skip operation at zero-cost. It's a bit more boilerplate to
set up the session and the HTTP message, but might be worth it if you skip
numerous bytes.

Le mer. 28 août 2019, à 04 h 54, Arvind Arvind Pro 
a écrit :

> Hi
>
> I want to use Vala code to download only a portion in the latter part of a
> file from internet-
>
> This is the code I have worked on so far-
>
> var file = File.new_for_uri (url);
> var file_stream = file.read ();
> var data_stream = new DataInputStream (file_stream);
> data_stream.skip (offset);
> singlelineofdata = file_stream.read ( offset, 80, 1);
>
> What I want to know is this- offset is the number of bytes within the
> file, after which I want to download the remaining content.
> Is the above code correct? Because skip should either mean that the
> content being skipped has already being downloaded, whereas I wish to
> download the portion after the offset. (A random number of bytes for this
> example). If the above is not correct then what is the correct way of doing
> this.
>
>
> Yours sincerely,
> Arvind.
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>


-- 
Guillaume Poirier-Morency 

Étudiant à la maîtrise en informatique à l'Université de Montréal
Chercheur à l'Institut de recherche en immunologie et en cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] valaDevelop

2019-03-20 Thread Guillaume Poirier-Morency via vala-list
I'm curious. Are you using libvala for providing these features?

Le mar. 19 mars 2019, à 19 h 17, Wolfgang Mauer 
a écrit :

> It would be nice if you can update the Wiki.
>
> The feature "*Jump to Definition*" is now available with valaDevelop
>
>
> Thanks a lot
>
> Wolfgang
>
>
> Am 11.03.19 um 04:30 schrieb Guillaume Poirier-Morency:
>
> I just added the entry in the Wiki.
>
> Le dim. 10 mars 2019, à 10 h 17, Wolfgang Mauer <
> wolfgang.ma...@kabelmail.de> a écrit :
>
>> Implemented so far...
>>
>> Solution/Project-management (including resources/packages)
>> Syntax-Highlight (GtkSourceView-3) search/replace/etc.)
>> Integrated Build, Test and Debug
>> -> Integrated Debugging with full symbol resolving support (only vala
>> source, no .c files necessary, no --save-temps)
>> -> Integrated Build (raw output available)
>>
>>
>> Greetings
>>
>> Wolfgang
>>
>> PS: Please, please, please... Don't call it Editor ;-)
>>
>>
>> Am 05.03.19 um 15:30 schrieb Guillaume Poirier-Morency:
>>
>> Just a suggestion: you should setup a simple GitHub page from the
>> repository and ship sources as assets in empty releases if you don't
>> intend to distribute the source code.
>>
>> I'm not a big fan of freeware, but since we already display IDE like
>> IntelliJ and TextMate, I think it's fine to put your work as well.
>>
>> What features are implemented so far?
>>
>> Le lundi 04 mars 2019 à 19:28 +0100, Wolfgang Mauer a écrit :
>>
>> Thanks for the attention!
>>
>> I hope I can answer correctly to your satisfaction.
>>
>> Some of the features are not fully implemented yet.
>>
>> Well, as the name suggests, everything is integrated.
>> Solution/Project-management (one solution, many projects)
>> Syntax-Highlight
>> Jump to Declaration (sourcecode/valadoc)
>> Debugging (only vala source, no .c files necessary, no --save-temps)
>> Building
>> Auto-Completion
>> Symbol Resolving, debug and edit mode by Tool tip
>> Git integration
>> There are no additional tools such as make/meson/ninja/etc. required.
>> The only one is the vala-compiler (valac).
>>
>> Upon completion, all features that comprise each tool should be
>> available in one.
>>
>> You can see some of the early screenshots here 
>> https://github.com/wolfgangmauer/valaDevelop
>>
>> Greetings
>> Wolfgang
>> PS. Also a macOS - Version will be available
>>
>>
>> Am 04.03.19 um 18:40 schrieb Guillaume Poirier-Morency:
>>
>> What features are supported by your IDE?
>>
>> Le dim. 3 mars 2019, à 05 h 47, Wolfgang Mauer  
>> a écrit :
>>
>> Hi,
>>
>> it would be nice if you update the 
>> "https://wiki.gnome.org/Projects/Vala/Tools; 
>> <https://wiki.gnome.org/Projects/Vala/Tools> / 
>> "https://wiki.gnome.org/Projects/Vala/ValaForCSharpProgrammers; 
>> <https://wiki.gnome.org/Projects/Vala/ValaForCSharpProgrammers>
>> and add
>> my IDE (https://github.com/wolfgangmauer/valaDevelop)
>>
>>
>> Greetings
>>
>> Wolfgang
>>
>>
>> ___
>> vala-list mailing 
>> listvala-list@gnome.orghttps://mail.gnome.org/mailman/listinfo/vala-list
>>
>> --
>> Guillaume Poirier-Morency  
>> 
>>
>> Étudiant à la maîtrise en informatique à l'Université de Montréal
>> Chercheur à l'Institut de recherche en immunologie et en
>> cancérologie
>>
>> Page Web: arteymix.github.io
>> Clé PGP: B1AD6EA5
>>
>>
>
> --
> Guillaume Poirier-Morency 
>
> Étudiant à la maîtrise en informatique à l'Université de Montréal
> Chercheur à l'Institut de recherche en immunologie et en cancérologie
>
> *Page Web:* arteymix.github.io
> *Clé PGP:* B1AD6EA5
> <https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
>
>

-- 
Guillaume Poirier-Morency 

Étudiant à la maîtrise en informatique à l'Université de Montréal
Chercheur à l'Institut de recherche en immunologie et en cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] valaDevelop

2019-03-10 Thread Guillaume Poirier-Morency via vala-list
I just added the entry in the Wiki.

Le dim. 10 mars 2019, à 10 h 17, Wolfgang Mauer 
a écrit :

> Implemented so far...
>
> Solution/Project-management (including resources/packages)
> Syntax-Highlight (GtkSourceView-3) search/replace/etc.)
> Integrated Build, Test and Debug
> -> Integrated Debugging with full symbol resolving support (only vala
> source, no .c files necessary, no --save-temps)
> -> Integrated Build (raw output available)
>
>
> Greetings
>
> Wolfgang
>
> PS: Please, please, please... Don't call it Editor ;-)
>
>
> Am 05.03.19 um 15:30 schrieb Guillaume Poirier-Morency:
>
> Just a suggestion: you should setup a simple GitHub page from the
> repository and ship sources as assets in empty releases if you don't
> intend to distribute the source code.
>
> I'm not a big fan of freeware, but since we already display IDE like
> IntelliJ and TextMate, I think it's fine to put your work as well.
>
> What features are implemented so far?
>
> Le lundi 04 mars 2019 à 19:28 +0100, Wolfgang Mauer a écrit :
>
> Thanks for the attention!
>
> I hope I can answer correctly to your satisfaction.
>
> Some of the features are not fully implemented yet.
>
> Well, as the name suggests, everything is integrated.
> Solution/Project-management (one solution, many projects)
> Syntax-Highlight
> Jump to Declaration (sourcecode/valadoc)
> Debugging (only vala source, no .c files necessary, no --save-temps)
> Building
> Auto-Completion
> Symbol Resolving, debug and edit mode by Tool tip
> Git integration
> There are no additional tools such as make/meson/ninja/etc. required.
> The only one is the vala-compiler (valac).
>
> Upon completion, all features that comprise each tool should be
> available in one.
>
> You can see some of the early screenshots here 
> https://github.com/wolfgangmauer/valaDevelop
>
> Greetings
> Wolfgang
> PS. Also a macOS - Version will be available
>
>
> Am 04.03.19 um 18:40 schrieb Guillaume Poirier-Morency:
>
> What features are supported by your IDE?
>
> Le dim. 3 mars 2019, à 05 h 47, Wolfgang Mauer  
> a écrit :
>
> Hi,
>
> it would be nice if you update the 
> "https://wiki.gnome.org/Projects/Vala/Tools; 
> <https://wiki.gnome.org/Projects/Vala/Tools> / 
> "https://wiki.gnome.org/Projects/Vala/ValaForCSharpProgrammers; 
> <https://wiki.gnome.org/Projects/Vala/ValaForCSharpProgrammers>
> and add
> my IDE (https://github.com/wolfgangmauer/valaDevelop)
>
>
> Greetings
>
> Wolfgang
>
>
> ___
> vala-list mailing 
> listvala-list@gnome.orghttps://mail.gnome.org/mailman/listinfo/vala-list
>
> --
> Guillaume Poirier-Morency  
> 
>
> Étudiant à la maîtrise en informatique à l'Université de Montréal
> Chercheur à l'Institut de recherche en immunologie et en
> cancérologie
>
> Page Web: arteymix.github.io
> Clé PGP: B1AD6EA5
>
>

-- 
Guillaume Poirier-Morency 

Étudiant à la maîtrise en informatique à l'Université de Montréal
Chercheur à l'Institut de recherche en immunologie et en cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] valaDevelop

2019-03-05 Thread Guillaume Poirier-Morency via vala-list
Just a suggestion: you should setup a simple GitHub page from the
repository and ship sources as assets in empty releases if you don't
intend to distribute the source code. 

I'm not a big fan of freeware, but since we already display IDE like
IntelliJ and TextMate, I think it's fine to put your work as well.

What features are implemented so far?

Le lundi 04 mars 2019 à 19:28 +0100, Wolfgang Mauer a écrit :
> Thanks for the attention!
> 
> I hope I can answer correctly to your satisfaction.
> 
> Some of the features are not fully implemented yet.
> 
> Well, as the name suggests, everything is integrated.
> Solution/Project-management (one solution, many projects)
> Syntax-Highlight
> Jump to Declaration (sourcecode/valadoc)
> Debugging (only vala source, no .c files necessary, no --save-temps)
> Building
> Auto-Completion
> Symbol Resolving, debug and edit mode by Tool tip
> Git integration
> There are no additional tools such as make/meson/ninja/etc. required.
> The only one is the vala-compiler (valac).
> 
> Upon completion, all features that comprise each tool should be
> available in one.
> 
> You can see some of the early screenshots here 
> https://github.com/wolfgangmauer/valaDevelop
> 
> Greetings
> Wolfgang
> PS. Also a macOS - Version will be available
> 
> 
> Am 04.03.19 um 18:40 schrieb Guillaume Poirier-Morency:
> > What features are supported by your IDE?
> > 
> > Le dim. 3 mars 2019, à 05 h 47, Wolfgang Mauer <
> > wolfgang.ma...@kabelmail.de> a écrit :
> > > Hi,
> > > 
> > > it would be nice if you update the 
> > > "https://wiki.gnome.org/Projects/Vala/Tools; / 
> > > "https://wiki.gnome.org/Projects/Vala/ValaForCSharpProgrammers;
> > > and add 
> > > my IDE (https://github.com/wolfgangmauer/valaDevelop)
> > > 
> > > 
> > > Greetings
> > > 
> > > Wolfgang
> > > 
> > > 
> > > ___
> > > vala-list mailing list
> > > vala-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/vala-list
> > > 
> > 
> > 
> > -- 
> > Guillaume Poirier-Morency 
> > 
> > Étudiant à la maîtrise en informatique à l'Université de Montréal
> > Chercheur à l'Institut de recherche en immunologie et en
> > cancérologie
> > 
> > Page Web: arteymix.github.io
> > Clé PGP: B1AD6EA5
-- 
Guillaume Poirier-Morency 

Étudiant à la maîtrise en informatique à l'Université de Montréal
Chercheur à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] valadoc

2018-12-14 Thread Guillaume Poirier-Morency via vala-list
I don't think so. The search functionality is using a POST request to
retrieve a partial HTML template containing the search result.

Le ven. 14 déc. 2018, à 06 h 55, Wolfgang Mauer 
a écrit :

> Hi all,
>
> is there a way to include a "search" i the valadoc url?
>
> Something like "https://valadoc.org/search?=Gtk.Label; ?
>
>
> Thanks for help
>
> Wolfgang
>
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>


-- 
Guillaume Poirier-Morency 

Étudiant à la maîtrise en informatique à l'Université de Montréal
Chercheur à l'Institut de recherche en immunologie et en cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Null Coalescing Assignment Operator

2017-05-28 Thread Guillaume Poirier-Morency
Le dimanche 28 mai 2017 à 10:20 +0200, Ulink a écrit :
> > thing = thing ? create ();
> 
> I think you meant
> 
> thing = thing ?? create ();

Yeah, my mistake! Evan actually pointed that out first on IRC.

> 
> Edward seems lazy and don't want to write "thing" two times ;-)

What I think we need is an Elvis accessor to turn:

   C? c = null;
var a = thing_a ();
if (a != null) {
var b = thing_b ();
if (b != null) {
c = thing_c ();
}
}

into:

var c = thing_a ()?.thing_b ()?.thing_c ();

> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Null Coalescing Assignment Operator

2017-05-27 Thread Guillaume Poirier-Morency
What's wrong with:

thing = thing ? create ();

Le samedi 27 mai 2017 à 16:46 -0700, Edward Hennessy a écrit :
> This snippet shows a common implementation of lazy initialization:
> 
>   if (thing == null)
>   {
>   thing = create();
>   }
> 
> 
> It would be nice to have a concise form using a null coalescing
> operator, like:
> 
>   thing ??= create();
> 
> 
> Would a null coalescing assignment operator be a reasonable addition
> to Vala?
> 
> Ed
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Roadmap for extending Vala's reach

2017-05-19 Thread Guillaume Poirier-Morency
Le dimanche 07 mai 2017 à 14:05 +1000, Michael Gratton a écrit :
> Hey Guillaume,
> 
> I think this is a generally good idea - didn't vala already have
> some 
> notion of profiles already though?

The notion of profiles has been dropped for maintainability. What I'm
proposing here is not profiles per-se, but more a modular design with a
core Vala compiler.

It will also be the basis for general compiler plugins once the libvala
API will be stabilized.

> 
> In particular I like getting rid of the implicit "using GLib" -
> explcit 
> is always better. It's especially annoying given every single symbol 
> from all of of GLib, GObject and GIO is crammed into that one
> namespace.

Same here, I always put "using GLib" to make things clearer.

> 
> WRT --nostdpkg, I kind of wonder if it's a better idea to instead 
> simply bump the major version number and drop backwards compat, so
> we 
> know that existing projects will continue to compile fine with the
> old 
> 0.x series, at no additional development overhead cost. Once
> projects 
> have migrated to having an explicit --pkg=glib-2.0 and "using GLib" 
> then they can just cut over to 1.x of the compiler.

Personally, I think it would be more efficient to make thoses changes
incrementally and release them continuously to get some solid feedback.

I don't really want to have a pending wip/transform again for years and
if we decide to make all those in the perspective of a 1.x, it will
never release.

Let's do what we can do now and make it usable with --nostdpkg and in a
1.x, we'll just drop explicit stuff.

> 
> This would also be a good opportunity to split GLib, GObject and GIO
> up 
> into separate namespaces, which would be more consistent with this 
> suggested approach of using --pkg to enable compiler-specific
> features.

I'm not so sure about all this. These three already use the same C
namespace 'g_', so it's already consistent to have them under the same
Vala namespace.

> 
> //Mike
> 
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Roadmap for extending Vala's reach

2017-05-07 Thread Guillaume Poirier-Morency
Le dimanche 07 mai 2017 à 12:17 +0200, Dr. Michael Lauer a écrit :
> Excellent idea, Guillaume,
> 
> I was pretty disappointed with the removal of the Posix profile,
> since there is quite some potential usage in embedded, kernel-space,
> and
> firmware niches.
> 
> Please see https://github.com/radare/posixvala
> <https://github.com/radare/posixvala> for reference.


I hope that this could be a game changer for you then:

https://github.com/radare/posixvala/pull/11

Ideally, and like I've probably already answered, Vala would support
this out-of-the-box, possibly with a reduced feature set, but still.

> 
> Best regards,
> 
> :M:
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Roadmap for extending Vala's reach

2017-05-07 Thread Guillaume Poirier-Morency
Le dimanche 07 mai 2017 à 12:17 +0200, Dr. Michael Lauer a écrit :
> Excellent idea, Guillaume,
> 
> I was pretty disappointed with the removal of the Posix profile,
> since there is quite some potential usage in embedded, kernel-space,
> and
> firmware niches.

I think it can make a nice comeback with --nostdpkg and this approach
would lead us to have a core compiler for building basically anything
that could be done using a C compiler. There is no profile as far as I
could tell.

> 
> Please see https://github.com/radare/posixvala
> <https://github.com/radare/posixvala> for reference.

I've seen it! Reimplementing parts GLib is not really convenient
though.

> 
> Best regards,
> 
> :M:
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Roadmap for extending Vala's reach

2017-05-06 Thread Guillaume Poirier-Morency
Hello all!

We currently have a very promiscous relationship with GLib and I would
like to propose some changes to make this more explicit.

Each --pkg argument would consist of a VAPI and a compiler plugin (from
wip/transform) for generating specific code and extending the language
syntax. One optional plugin per package seems sane to me.

No --pkg arguments at all:

 * basic Vala syntax
 * basic C codegen
 * standard C types (int, uint -> unsigned int, char, uchar, ...)
 * no API

At this point, one could introduce a different set of definitions for
supporting, let's say, a micro-controller C standard library in just a
matter of a --pkg flag.

With --pkg=posix

 * posix C API

With --pkg=glib-2.0

 * shadowed standard C types in GLib.* namespace, which would become in
   default with a 'using GLib;' declaration
 * GLib C API
 * support for basic introspection (--gir and the like)

No more imlicit 'using GLib;'. However, including it would shadow all
the numerical types and produce a nice GLib-friendly API.

With --pkg=gobject-2.0 

 * GObject API
 * typeof
 * signals
 * support for advanced introspection

With --pkg=gio-2.0 

 * GIO API
 * asynchronous primitives
 * DBus code generator

With --pkg=gtk-3.0

 * GTK API
 * [GtkBuilder] annotations

We can have a pure Posix C backend and compile anything with:

valac --ccode --pkg=posix main.vala

public int main () {} => int main (void) {}

Or if one would like to target Emscripten platform:

valac --ccode --pkg=emscripten main.vala

public int main () {} => #include int main (void) {}

For usual GLib code:

valac --ccode --pkg=glib-2.0 main.vala

using GLib;

public int main () {} => gint main (void) {}

It would be breaking stuff that is not explicitly using --pkg=glib-2.0
and 'using GLib'. We could actually use the '--nostdpkg' switch to sort
of reset the compiler down to it's most basic feature set and wait
until 1.0 to drop it and have some good defaults.

At first, it would be to make --nostdpkg work flawlessly while
preserving entire backward-compatibility. That'll be good for a minor
release.

Tell me what you think about this!

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] About GTask constructor

2017-04-18 Thread Guillaume Poirier-Morency
There is no 'g_task_new_finish' symbol that correspond to the asynchronous
constructor of GTask.

Is there anything I can do to fix that?

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'Institut de recherche en immunologie et en
cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Nice stuff incoming for the next Meson release

2017-04-11 Thread Guillaume Poirier-Morency
There's a couple of changes on the way for the next release of Meson
(0.40.0) that will have a really good and positive aspect for people using
Vala:

   - support for multiple install directories (girdir, vapidir, includedir,
   ...)
   - support for VALAFLAGS and -Dvala_args to pass compiler arguments from
   an external source
   - arguments for specific GIR and VAPI install directory
   - better and more consistent arguments for Vala targets

If you don't use Meson yet, I strongly suggest you to consider using it and
help me making it into tier-1 language!

Related PRs:

   - https://github.com/mesonbuild/meson/pull/1469
   - https://github.com/mesonbuild/meson/pull/1599
   - https://github.com/mesonbuild/meson/pull/954
   - https://github.com/mesonbuild/meson/pull/1603
   - https://github.com/mesonbuild/meson/pull/1610

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'Institut de recherche en immunologie et en
cancérologie

*Page Web:* arteymix.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to check if string is empty

2017-01-16 Thread Guillaume Poirier-Morency
Le lundi 16 janvier 2017 à 17:27 -0200, Alexandre Oliveira a écrit :
> I tried this in my method, even replacing 'string' for 'string?', but
> I
> still get the same message in my terminal.
> 
> What is your suggestion to suppress these messages?

The following snippet works perfectly fine:

bool is_null_or_empty (string? a) {
return a == null || a.length == 0;
}

assert (is_null_or_empty (null));
assert (is_null_or_empty (""));
assert (!is_null_or_empty (" "));

> 
> On 16/01/2017 17:23, Guillaume Poirier-Morency wrote:
> > You should test for nullity before addressing the string.
> > 
> > return str == null || str.length == 0;
> > 
> > If you expect the string to be potentially 'null', use the
> > 'string?'
> > type instead.
> > 
> > 2017-01-16 14:09 GMT-05:00 Alexandre Oliveira <xinay...@airmail.cc
> > <mailto:xinay...@airmail.cc>>:
> > 
> > Hello!
> > 
> > I've just heard about Vala and I've been messing around with it
> > these
> > past days.
> > 
> > However, I came across a problem. I need to check if some
> > strings aren't
> > empty, and I realized there's no method in Vala that's
> > equivalent to
> > C#'s `string.IsNullOrEmpty(string)`.
> > 
> > I tried setting up a static method to check if the given string
> > is
> > empty:
> > ```
> > static bool is_empty(string str) {
> > return str[0] == '\0' || str == null;
> > }
> > ```
> > 
> > However, running my code, I get the following message
> > repeatedly in my
> > terminal: ** (main.exe:2288): CRITICAL **: is_empty: assertion
> > 'str !=
> > NULL' failed
> > 
> > What am I doing wrong?
> > 
> > Thanks!
> > --
> > Alexandre Oliveira
> >   167F D82F 514A E8D1 2E9E
> >   C62D 1B63 9D4A 7E9D DA9D
> > ___
> > vala-list mailing list
> > vala-list@gnome.org <mailto:vala-list@gnome.org>
> > https://mail.gnome.org/mailman/listinfo/vala-list
> > <https://mail.gnome.org/mailman/listinfo/vala-list>
> > 
> > 
> > 
> > 
> > -- 
> > Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com
> > <mailto:guillaumepoiriermore...@gmail.com>>
> > 
> > Étudiant au baccalauréat en Informatique à l'Université de Montréal
> > Développeur d'application web
> > 
> > *Mon blog:* arteymix.github.io <https://arteymix.github.io>
> > *Mon projet de coopérative:* pittoresque.github.io
> > <https://pittoresque.github.io>
> > *Clé PGP:* B1AD6EA5
> > <https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5
> > >
> 
> 
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Vast and other numerical projects

2016-11-26 Thread Guillaume Poirier-Morency
Hi all,

I'm working on a really nice project in collaboration with Yu Feng.

https://github.com/rainwoodman/vast

In the short term, this will provide a multi-dimensional dense array
implementation comparable to NumPy minus the Python runtime overhead.
There's already a couple of view routines implemented and we plan to
generate code, lot's of it!

I have a separate project which provide additional numerical types to
be used in the dense array (or anywhere else for that matter):

https://github.com/arteymix/numeric-glib

Then we'll address computation graph with the goal of reducing the time
needed to evaluate and compute gradients when processing data with high
dimensionality compared to other existing tools. This should be heavily
based on GObject Introspection to conveniently inject existing code
into the graph.

There's some future plan to implement a Jupyter/IPython kernel for Vala
and Genie. I have some drafts of using libvala to rewrite snippets AST
into chained blocks and evaluate them using forked processes. It should
not be too difficult considering that we already have ZeroMQ bindings
and an excellent library for the language.

While all these are pet projects, I am pretty optimist that we will
have a nice general purpose multi-dimensional array implementation for
crunching some serious numbers out of all that.

Best regards,

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Valadoc.org is fully operational again

2016-11-24 Thread Guillaume Poirier-Morency
Le mercredi 23 novembre 2016 à 10:56 +, Al Thomas via vala-list a
écrit :
> In case anyone hadn't noticed valadoc.org is fully working again.
> 
> Thanks to Elementary OS [1] who are hosting the site [2].
> 
> Development is now being done at https://github.com/valadoc and
> includes a number of recent updates, including better URIs for
> bookmarking and external linking. There is also work started on
> changing valadoc.org to use Valum [3].

The docs and static assets are served so far and I still have to
reimplement the tooltip and search feature (which only require
accessing a MySQL database with Gda).

If anyone would like to test it, I also provided a Vagrantfile to
provision a VM and run the site.

vagrant up
vagrant provision
vagrant ssh
cd valadoc-org
make serve # or make serve-mini

It should be noticeably faster due to use of proactive caching with
ETag headers.

The first transition will be drop-in, then we shall look into the
possibility of serving and searching docs as a service.

> 
> The content is up to date. With Valum 0.3 [4] and libcolumbus [5]
> recently being added.
> 
> Thanks should also go out to Chris Daley of Valadate project for
> hosting a mirror ( http://valadoc.valadate.org ) and the company
> RooJSolutions ( http://valadoc.roojs.com ) for also hosting a mirror
> while things got back to normal.
> 
> [1] - https://elementary.io/
> [2] - http://blog.elementary.io/post/152967321211/were-now-hosting-va
> ladocorg
> [3] - https://github.com/Valadoc/valadoc-org/pull/40
> [4] - https://arteymix.github.io/valum/2016/11/11/announcing-valum-0-
> 3.html
> [5] - http://voices.canonical.com/jussi.pakkanen/2012/12/03/introduci
> ng-libcolumbus-a-fast-online-approximate-matching-library/
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Libsoup websockets

2016-09-21 Thread Guillaume Poirier-Morency
In general, with GIO, you don't need to run anything in a subprocess.
Keeping it single-threaded and let async I/O dictate your concurrence
model.

One really nice way to scale on multi-core is to notably use
subprocesses through fork. Once you listen, you can fork before
launching loops.

server.listen_local (8080);

Posix.fork (); // 2
Posix.fork (); // 4
Posix.fork (); // 8 process

new MainLoop ().run ();

They now all share a common file descriptor for the listening interface
and the kernel will perform load balancing across the workers for free.
I managed to scale an application on 64 cores this way ;) reaching
~100k req/sec this way.

Good luck,

Le mercredi 21 septembre 2016 à 15:21 +0100, Baptiste Gelez a écrit :
> Hi everyone,
> 
> I'm creating a little app that should be able to communicate with
> other 
> processes (both sending and receiving messages). I first tried to do
> it 
> by launching child processes and sending/receving messages with 
> stdout/stdin. But I didn't find how to receive a signal when the
> child 
> process is writing on his stdout.
> 
> Then, I tried with websockets. I use the libsoup solution. This is
> my 
> code :
> 
> const uint16 port = 8080;
> 
> InetAddress address = new InetAddress.loopback (SocketFamily.IPV4);
> InetSocketAddress inetaddress = new InetSocketAddress (address,
> port);
> 
> GLib.Socket socket = new GLib.Socket (SocketFamily.IPV4, 
> SocketType.STREAM, SocketProtocol.TCP);
> socket.bind (inetaddress, true);
> socket.listen ();
> 
> Server serv = new Server (null);
> serv.add_websocket_handler (null, null, null, (server, conn, path, 
> client) => {
>  conn.message.connect ((type, message) => {
>  // receive messages en responds ...
>  });
>  });
> serv.listen_socket (socket, 0);
> 
> But when I try to connect to ws://localhost (with JavaScript) it
> tells 
> me "Firefox can't establish a connection with the server at the
> address 
> ws://localhost/."
> 
> Valadoc and libsoup C documentation are really poor on Websockets.
> Can 
> you help me to find where is the problem, and how to solve it,
> please. 
> Or at least, giving me some example codes of websocket servers with 
> libsoup (I can't find any). Thank you.
> 
> Baptiste.
> _______
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Libsoup websockets

2016-09-21 Thread Guillaume Poirier-Morency
Le mercredi 21 septembre 2016 à 15:21 +0100, Baptiste Gelez a écrit :
> Hi everyone,
> 
> I'm creating a little app that should be able to communicate with
> other 
> processes (both sending and receiving messages). I first tried to do
> it 
> by launching child processes and sending/receving messages with 
> stdout/stdin. But I didn't find how to receive a signal when the
> child 
> process is writing on his stdout.
> 
> Then, I tried with websockets. I use the libsoup solution. This is
> my 
> code :
> 
> const uint16 port = 8080;
> 
> InetAddress address = new InetAddress.loopback (SocketFamily.IPV4);
> InetSocketAddress inetaddress = new InetSocketAddress (address,
> port);
> 
> GLib.Socket socket = new GLib.Socket (SocketFamily.IPV4, 
> SocketType.STREAM, SocketProtocol.TCP);
> socket.bind (inetaddress, true);
> socket.listen ();
> 
> Server serv = new Server (null);
> serv.add_websocket_handler (null, null, null, (server, conn, path, 
> client) => {
>  conn.message.connect ((type, message) => {
>  // receive messages en responds ...
>  });
>  });
> serv.listen_socket (socket, 0);
> 
> But when I try to connect to ws://localhost (with JavaScript) it
> tells 
> me "Firefox can't establish a connection with the server at the
> address 
> ws://localhost/."
> 
> Valadoc and libsoup C documentation are really poor on Websockets.
> Can 
> you help me to find where is the problem, and how to solve it,
> please. 
> Or at least, giving me some example codes of websocket servers with 
> libsoup (I can't find any). Thank you.
> 
> Baptiste.
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list

You should try the 'ws://localhost:8080/' URI instead. It's also
necessary to run a GLib.MainLoop.

Also, you don't need to bind a socket manually if you only want to
listen on the loopback interface, 'listen_local' does that already.

Here's a fully working example:

using GLib;
using Soup;

var serv = new Server (null);
serv.add_websocket_handler (null, null, null, (server, conn, path,
client) => {
 conn.message.connect ((type, message) => {
 // receive messages en responds ...
 });
 });
serv.listen_local(8080, 0);

new MainLoop ().run ();

Then connect to 'ws://localhost:8080/'.

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] The future of Vala

2016-09-13 Thread Guillaume Poirier-Morency
es, closures, async dbus, etc.
> > Alas, my knowledge of the compiler internals is zero. One reason why FSO
> has been stalling is that I'm unsure
> > about whether Vala is going anywhere towards a stable (with reasonably
> sane criteria of stableness) 1.0.
> > I’m also the creator of numerous bug entries where Vala generates
> invalid C code and the Vala programmer
> > is scared with an incomprehensible gcc error message. As far as I can
> see many of those are still open for a
> > bunch of years now – which makes me feel somewhat pessimistic about the
> future of Vala.
> Well, given that the official maintainers are effectively inactive, the
> future of Vala is clearly what we
> make of it! Have you ever thought about hacking the compiler? I didn't
> find it that hard on a technical level,
> and I'd certainly answer any questions I can.
>
> > I’d welcome advise from the father of Vala, Joerg (or anyone other with
> solid knowledge of the core),
> > to give us some direction. Would a redesign / rewrite be necessary to
> move forward to an 1.0 or
> > would refactoring the compiler be enough to lower the contribution
> barrier?
> Well, it depends on where we want to take the language! I have a few fixes
> and features in mind that I'd like
> to address, and I can go into more detail if anybody is interested. What
> is it that you would like to see?
>
> Cheers,
> Matthias
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>



-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

*Mon blog:* arteymix.github.io
*Mon projet de coopérative:* pittoresque.github.io
*Clé PGP:* B1AD6EA5
<https://pgp.mit.edu/pks/lookup?op=vindex=0x1CCFC3A2B1AD6EA5>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to override a "class closure for a signal"?

2016-07-28 Thread Guillaume Poirier-Morency
When you override a virtual signal, you only override its default
handler, so you don't specify 'signal' in the new method:

public class MyListBox : Gtk.ListBox
{
    public override void set_focus_child (Widget? widget)
    {
        // override default handler here
    }
}

Not sure here, but I think that if you define a signal without a
default handler, it is not possible to override it as it does not
exist.

There's also mechanism to stop signals from bubbling in GObject if that
can help you: http://www.valadate.org:8000/#!api=gobject-2.0/GLib.Signa
l However, I don't know how to fetch the signal id from Vala.

Le jeudi 28 juillet 2016 à 18:22 +1000, Michael Gratton a écrit :
> Hey all,
> 
> I have a subclass of Gtk.ListBox and I'm trying to override 
> Gtk.Container::gtk_container_set_focus_child on it to prevent its 
> default behaviour of automatically scrolling to the new focus child. 
> The docs for that method say this:
> 
> > 
> > This function emits the GtkContainer::set_focus_child signal of 
> > container. Implementations of GtkContainer can override the
> > default 
> > behaviour by overriding the class closure of this signal.
> 
> How exactly do I do that? I tried overriding the method using:
> 
> > 
> > public override void set_focus_child(Gtk.Widget? child) { ... }
> 
> But even if I do not chain up using a call to 
> "base.set_focus_child(child)", it seems Gtk.Container's method is
> still 
> invoked.
> 
> I also tried overriding the signal body using variously:
> 
> > 
> > public override signal void set_focus_child(Gtk.Widget? child) {
> > ... }
> > public new signal void set_focus_child(Gtk.Widget? child) { ... }
> 
> But then valac complains that it "hides inherited signal" in the
> first 
> case and "Only virtual signals can have a default signal handler
> body" 
> for both.
> 
> Any hints? Thanks!
> 
> //Mike
> 
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] New data API written in Vala

2016-07-22 Thread Guillaume Poirier-Morency
I thought it might interest some of you.

We recently launched a data service built upon Valum, the micro-
framework I've been working for quite a moment already.

http://mirbooking.major.iric.ca/

It's alpha and the job API is still in progress, but it can give you a
nice idea of what one can build with Vala.

Here are the technologies backing the service:

 * libgda-5.0 with MySQL
 * SAGA-GLib (still in progress)
 * TORQUE and GXml for the SAGA backend
 * Swagger for the specification
 * JSON-API to format payloads using JSON-API-GLib
 * Bump for its really handy ResourcePool to manage Gda.Connection
   objects
 * Docker

The data service will also be available in MessagePack as I am working
on a Json.Node serializer.

If you have any questions or feedback, don't hesitate!

P.S. Be kind and mail me if you find any bugs ;)

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Just a news I've read about popularity langage

2016-07-21 Thread Guillaume Poirier-Morency
Le jeudi 21 juillet 2016 à 17:43 +0300, Aleksandr Palamar a écrit :
> > 
> > This is nice. What could be done to push vala further in adoption?
> 
> 
>    1. Better support for other C compilers, like MSVC on Windows and
> Clang.
>    When building library on Windows it doesn't define
> __declspec(dllexport) in
>    generated headers which means you cannot use Vala with MSVC
> properly if you
>    want to make an DLL instead of EXE.
>    2. Vala-DBG which can do something like debugging of CoffeeScript
> in
>    Chrome is working. I mean something like JavaScript Source Maps
> but for C -
>    http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

Vala already generate '#line' preprocessor directives if you specify
the '--debug' flag. It is used by gdb and gcov to resolve the original
sources, meaning that you can debug quite effectively.

>    3. Package Manager, Vala already has a nice place with lot of nice
> VAPIs
>    (https://github.com/nemequ/vala-extra-vapis), but better approach
> to
>    have own package manager with auto-resolving of dependencies (like
> NPM in
>    Node or Cargo in Rust).

I would really enjoy a source package manager to retreive bindings and
external Vala projects. So far, I'm happy with Meson and subprojects.

>    4. Better integration and maintaining of Vala among most popular
> IDEs,
>    including MSVC, NetBeans, Eclipse.
>    5. Transparent usage of C++ libraries via some modified VAPI
> syntax.
>    There are a lot of useful C++ libraries that people still
> need/want to use
>    in their project. If you want to keep that library usage
> exportable for
>    other C files in your project, you always can do *extern "C"*
> block to
>    avoid mangling.
>    6. Make some killer-application. Or more precise -
> library/framework. As
>    for Ruby that was Ruby On Rails, so Vala may have something own
> even in
>    other direction then Web.

I'm working on it. By the end of the summer we shall have a solid and
stable Web framework capable of taking real load.

https://github.com/valum-framework/valum

> 
> 
> On Thu, Jul 21, 2016 at 3:54 PM, Felipe Lavratti <felipe...@gmail.com
> >
> wrote:
> 
> > 
> > This is nice. What could be done to push vala further in adoption?
> > 
> > Em quinta-feira, 21 de julho de 2016, Adam Tauno Williams <
> > awill...@whitemice.org> escreveu:
> > 
> > > 
> > > On Thu, 2016-07-21 at 09:18 +0200, r...@no-log.org <javascript:;>
> > > wrote:
> > > > 
> > > > I've read this news :
> > > > > 
> > > > > http://redmonk.com/sogrady/2016/07/20/language-rankings-6-16/
> > > > > ?
> > > > As I understood, a lot of projects on GitHub and, because Vala
> > > > is
> > > > great (wink) less demand on Stack Overflow ^___^  (well, it's a
> > > > joke
> > > > :) But I think a lot of questions have been asked through this
> > > > mailing list instead of StackOverflow)
> > > 
> > > If true, thank goodness.  The myriad of web forums has damaged
> > > the
> > > critical mass of community a project can build.
> > > 
> > > > 
> > > > Just to share my hapiness to see Vala, for once, in a chart and
> > > > finally in a good position... ^__^
> > > 
> > > It compiles!  That is enough for me.  I do a lot of coding in
> > > Python -
> > > but the complexity of getting the runtime available is a major
> > > drag.
> > > 
> > > --
> > > Adam Tauno Williams <mailto:awill...@whitemice.org
> > > <javascript:;>> GPG
> > > D95ED383
> > > OpenGroupware Developer <http://www.opengroupware.us/>
> > > 
> > > 
> > > ___
> > > vala-list mailing list
> > > vala-list@gnome.org <javascript:;>
> > > https://mail.gnome.org/mailman/listinfo/vala-list
> > > 
> > 
> > 
> > --
> > Enviado do Gmail para celular
> > ___
> > vala-list mailing list
> > vala-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/vala-list
> > 
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Use rust [was: Seeking for Vala programmer]

2016-06-16 Thread Guillaume Poirier-Morency
Le jeudi 16 juin 2016 à 15:54 +0200, mar...@saepia.net a écrit :
> Valum is awesome, and I was considering it for a while but we have
> decided to use Elixir/Phoenix for our web backends (for obvious
> reasons if you are designing a soft-realtime software).

Phoenix looks really nice and complete. However, something more GLib-
based would be easier to integrate with a GStreamer audio stack I
guess.

Valum still need some work, but it's already usable and very fast. I
will probably release the 0.3 by the end of the summer.

I'm also implementing the SAGA specification https://en.wikipedia.org/w
iki/Simple_API_for_Grid_Applications if you ever need to distribute
some computation. I'm starting with the job API and a TORQUE backend
for my project.

> 
> But I keep it in mind and I won't be suprised if it would have been
> used in some of our microservices later on.
> 
> Marcin
> 
> 2016-06-15 22:30 GMT+02:00 Guillaume Poirier-Morency  rmore...@gmail.com>:
> > I just want to state that I'm in perfect agreement with you Marcin.
> > 
> > Rust might be a good system programming language, but it's clearly
> > not
> > ready for the needs of a product like RadioKit.
> > 
> > Vala is a good language with incredible C binding capabilities and
> > really nice set of semantics. It has direct access to GTK and
> > GStreamer, unlike what you would have with GIR and pose reasonable
> > overhead over GObject C.
> > 
> > Rewritting a working codebase because of a language hype is silly,
> > especially as it would result in a considerably lower utility.
> > 
> > Yet, Rust is a really nice language with a bright future and I
> > think it
> > should inpire us putting some efforts on making Vala safer.
> > 
> > Suit yourself,
> > 
> > N.B. RadioKit looks really amazing and I really wish I could be
> > part of
> > it, but obligations forbids. Maybe Valum could be handy?
> > 
> > Le mercredi 15 juin 2016 à 22:03 +0200, mar...@saepia.net a écrit :
> > > I don't say Rust is wrong. I don't even say it's worse than Vala
> > or
> > > less
> > > promising. There are just much more popular languages than Rust
> > that
> > > fail
> > > to maintain stable bindings to C libraries, including one I am
> > > interested
> > > of the most (GStreamer).
> > >
> > > As long as this https://crates.io/search?q=gst returns nothing
> > and
> > > this
> > > https://crates.io/search?q=glib returns bunch of immature
> > projects,
> > > it's
> > > just not an option. I am not going to spend half of my budget &
> > time
> > > for
> > > rewriting something that works perfectly in Vala just becuse some
> > > language
> > > appears to be promising.
> > >
> > > Marcin
> > >
> > >
> > > 2016-06-15 3:57 GMT+02:00 Daogang <daogangt...@126.com>:
> > >
> > > > don't care that, I just mention it.
> > > >
> > > > Rust is the most promising language in the coming 15 years,
> > > > https://www.rust-lang.org/.
> > > >
> > > > It is a system language, as c, c++, vala, but has more and more
> > > > powerful
> > > > theory basis than vala. It can reduce runtime bug significantly
> > for
> > > > its
> > > > safty feature.
> > > >
> > > > If let me choose, I want to recommand all elementary work
> > > > transfering to
> > > > rust.  :)  just keep your own direction.
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Gang Tang, Nothing is impossible.
> > > > +86 152 8102 0829
> > > >
> > > > Mamiwenwen.com, Chengdu, China.
> > > >
> > > >
> > > >
> > > > 在2016年06月14 23时09分, "Al Thomas"<astav...@yahoo.co.uk>写道:
> > > >
> > > >
> > > >
> > > >
> > > > From: Daogang <daogangt...@126.com>
> > > > Sent: Tuesday, 14 June 2016, 13:58
> > > > Subject: Re: [Vala] Seeking for Vala programmer
> > > >
> > > >
> > > > can consider rust lang? i think it is promissing.
> > > >
> > > >
> > > > An advantage of Vala is it has first class bindings to a large
> > > > number of
> > > > excellent projects, e.g. GStreamer, Gtk+.
> > > > A quick search on Rust found this tutorial dated December 2015,
> > but
> > > > now

Re: [Vala] Use rust [was: Seeking for Vala programmer]

2016-06-15 Thread Guillaume Poirier-Morency
I just want to state that I'm in perfect agreement with you Marcin.

Rust might be a good system programming language, but it's clearly not
ready for the needs of a product like RadioKit.

Vala is a good language with incredible C binding capabilities and
really nice set of semantics. It has direct access to GTK and
GStreamer, unlike what you would have with GIR and pose reasonable
overhead over GObject C.

Rewritting a working codebase because of a language hype is silly,
especially as it would result in a considerably lower utility.

Yet, Rust is a really nice language with a bright future and I think it
should inpire us putting some efforts on making Vala safer.

Suit yourself,

N.B. RadioKit looks really amazing and I really wish I could be part of
it, but obligations forbids. Maybe Valum could be handy?

Le mercredi 15 juin 2016 à 22:03 +0200, mar...@saepia.net a écrit :
> I don't say Rust is wrong. I don't even say it's worse than Vala or
> less
> promising. There are just much more popular languages than Rust that
> fail
> to maintain stable bindings to C libraries, including one I am
> interested
> of the most (GStreamer).
> 
> As long as this https://crates.io/search?q=gst returns nothing and
> this
> https://crates.io/search?q=glib returns bunch of immature projects,
> it's
> just not an option. I am not going to spend half of my budget & time
> for
> rewriting something that works perfectly in Vala just becuse some
> language
> appears to be promising.
> 
> Marcin
> 
> 
> 2016-06-15 3:57 GMT+02:00 Daogang <daogangt...@126.com>:
> 
> > don't care that, I just mention it.
> > 
> > Rust is the most promising language in the coming 15 years,
> > https://www.rust-lang.org/.
> > 
> > It is a system language, as c, c++, vala, but has more and more
> > powerful
> > theory basis than vala. It can reduce runtime bug significantly for
> > its
> > safty feature.
> > 
> > If let me choose, I want to recommand all elementary work
> > transfering to
> > rust.  :)  just keep your own direction.
> > 
> > 
> > 
> > 
> > --
> > Gang Tang, Nothing is impossible.
> > +86 152 8102 0829
> > 
> > Mamiwenwen.com, Chengdu, China.
> > 
> > 
> > 
> > 在2016年06月14 23时09分, "Al Thomas"<astav...@yahoo.co.uk>写道:
> > 
> > 
> > 
> > 
> > From: Daogang <daogangt...@126.com>
> > Sent: Tuesday, 14 June 2016, 13:58
> > Subject: Re: [Vala] Seeking for Vala programmer
> > 
> > 
> > can consider rust lang? i think it is promissing.
> > 
> > 
> > An advantage of Vala is it has first class bindings to a large
> > number of
> > excellent projects, e.g. GStreamer, Gtk+.
> > A quick search on Rust found this tutorial dated December 2015, but
> > now
> > advises "This guide is no longer compatible with the current
> > codebase and
> > thus will be rewritten in the future.":
> > 
> > https://mmstickman.wordpress.com/2015/12/12/phoronix-reader-rust-pr
> > ogramming-tutorial/
> > 
> > 
> > https://www.gitbook.com/book/mmstick/rust-programming-phoronix-read
> > er-how-to/details
> > 
> > So maybe there is some way for Rust to go on the bindings front. I
> > didn't
> > look too much at other differences.
> > 
> > Can you elaborate on your experiences with Rust and Vala that makes
> > you
> > recommend Rust?
> > 
> > 
> > Personally, I find it encouraging the Marcin Lewandowski and
> > RadioKit are
> > looking to employ a Vala programmer. Marcin has filed a number of
> > useful
> > bug reports after I think investing some considerable time in using
> > Vala. I
> > hope the Vala community continues to grow and address some of those
> > issues.
> > 
> > 
> > Al
> > ___
> > vala-list mailing list
> > vala-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/vala-list
> > 
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Extended floating types

2016-05-23 Thread Guillaume Poirier-Morency
It's possible to declare these types if you need to use them.

https://wiki.gnome.org/Projects/Vala/Manual/Attributes#FloatingType_Att
ribute

[CCode (has_type_id = false)]
[FloatingType (decimal = false, rank = 12, width = 128]
struct float128_t {}

Like Daniel said, Vala primitive types are mapped to GLib's type with
the GType system, so it's not really the language's fault if there is
no support for 128 bit floating points. It's not a common use case
either way.

With 'has_type_id = false', the compiler knows that there's no type
information to retreive.

Rank 12 does not really exist, but that would be the appropriate value
since 10 and 11 are for signed and unsigned 64 bit types.

It might be handy to have a VAPI for that in 'vala-extra-vapis'.

Cheers and best luck,

Le lundi 23 mai 2016 à 09:59 +0300, Vitaly V. Ch a écrit :
> Ok, Thanks.
> 
> It clarifies the situation.
> 
> With best regards,
> 
> Vitaly Chernooky
> 
> On Mon, May 23, 2016 at 4:51 AM, Daniel Espinosa <eso...@gmail.com>
> wrote:
> 
> > May you should be able to create your own basic type.
> > 
> > May should be a guide to do so.
> > 
> > GLib should have this types too, before you are able to create your
> > basic
> > types. This means you should define a GType for a basic type, in
> > this case
> > your long double.
> > 
> > May we can create a library to define this math basic types, to be
> > used in
> > other libraries. This is not a GLib interest, I think, because is
> > not a
> > primary Math library.
> > 
> > I was working a little in that, but may you should ask to gtk-list
> > for
> > help on defining this new types.
> > 
> > In other ideas, is required to use that types or is possible to use
> > some
> > structs holding your information in a way to be used in other
> > methods, that
> > may take that structs an do calculations using that types
> > internally,
> > written in C with Vala bindings [1], then return again that
> > structs.
> > 
> > [] See git.gnome.org/browse/gxml it uses simple C methods and Vala
> > bindings to be used in Vala code for xlibxml
> > El may. 22, 2016 3:23 PM, "Vitaly V. Ch" <vitaly.v...@gmail.com>
> > escribió:
> > 
> > Hi All!
> > 
> > Some time ago Vala has pulled my attention as a way to solve some
> > kind of
> > math problems. But some time later I realized that this cozy and
> > beautiful
> > staff does not have extended floating datatypes such as long double
> > or
> > float128_t. This fact disappointed me and I'm interested in some
> > comments.
> > 
> > With best regards,
> > 
> > Vitaly Chernooky
> > ___
> > vala-list mailing list
> > vala-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/vala-list
> > 
> > 
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Design - Serialization Library - Problem: ref and async

2016-04-02 Thread Guillaume Poirier-Morency
Le samedi 02 avril 2016 à 21:08 +0800, Alan Manuel Gloria a écrit :
> Hi all,
> 
> I'm trying to design a serialization library for Vala.
> 
> My initial design sketch was something like this:
> 
> // Library
> /* An object that can be saved or loaded.  */
> public
> interface Serializable : Object {
>   public abstract async
>   void serialize(Archive ar) throws Error;
> }
> /* An object that can save or load.  */
> public
> abstract class Archive : Object {
>   public abstract
>   bool is_saving();
>   public abstract async
>   void archive_string(ref string s) throws Error;
>   public abstract async
>   void archive_int(ref int i) throws Error;
>   /* .. a dozen other methods for various types  */
> }
> //Client code
> internal
> class Something : Object, Serializable {
>   private string name;
>   private int id;
>   public virtual async
>   void serialize(Archive ar) throws Error {
> yield ar.archive_string(ref name);
> yield ar.archive_int(ref id);
>   }
> }
> 
> The point of the design is that a Serializable would, ideally, have a
> single section of code for both loading and saving, to ensure that
> loading
> and saving are correctly compatible.  This pattern is similar to some
> serialization libraries in C++.
> 
> Since an archive could either be saving or loading, it needs ref
> access.
> 
> Unfortunately, it seems that there are a few good reasons that async
> and
> ref are not compatible.  The major one seems to be that exposing a
> ref
> argument of an async method to a non-async method could lead to a bug
> where
> the non-async method uses a local variable and passes it into the
> non-async
> method.  (for an async method, local variables are actually allocated
> in
> its data structure, so it's safe to use a local variable in an async
> method
> to another async method by ref).
> 
> I'd like to ask that ref and out be allowed in async, and restrict
> them so
> that async methods with ref/out arguments can only be called from
> other
> async methods (to avoid non-async variable reffed by an async method
> problem), but I'd probably need to work on that myself, haha.
> 
> So, given the limits of today's Vala, what would be better?
> 
> 1.  Remove "async".  This limits me to total data sizes that can
> comfortably be written or saved while blocking the main loop.  I
> could also
> serialize in a true OS background thread, and ensure somehow that the
> object being serialized is completely locked until the entire
> serialization
> is completed.
> 
> +: retain similar style as above.  -: blocking.
> 
> 2.  Remove "ref".  That means I code something like:
> 
> public virtual async
> void serialize(Archive ar) throws Error {
>   name = yield ar.archive_string(name);
>   id = yield ar.archive_int(id);
> }
> 
> +: still nonblocking.  -: specify object field twice (violate DRY),
> mismatch may lead to subtle bugs

Use out parameters instead, they are known to work with async
functions.

Personally, I would suggest that you use GVariant for serialization.
APIs are here: http://valadoc.org/#!api=glib-2.0/GLib.Variant

There is an example here using VariantBuilder and VariantIter http://va
ladoc.org/#!api=glib-2.0/GLib.VariantIter

Basically, an async method in Vala is a GSimpleAsyncResult that run in
a background thread (see GIO thread pool), so you don't really need to
work with threads here.

You could use Redis to save the states as it support binary storage or
store them in files.

> 
> Currently, my library client is a turn-based game where the Server
> component periodically saves its state if it is modified.
> 
> Sincerely,
> AmkG
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Asynchronous delegates (proposal)

2016-03-30 Thread Guillaume Poirier-Morency
I think it would be worth for Vala to support asynchronous delegates
and since I'll have some time this summer, I might as well work on that
feature.

I described the syntax in the following post:

http://arteymix.github.io/2016/03/30/async-delegates.html

I'm looking for suggestions and/or an elegant solution to the chaining
problem.

-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] disable free at block end

2016-03-10 Thread Guillaume Poirier-Morency
Le jeudi 10 mars 2016 à 23:34 +0530, MohanR a écrit :
> Hi,
> 
> May be a i'm wrong, but here is my issue,
> 
> namespace test {
>   struct Remote {
>   uint16 id;
>   uint32 ip;
>   }
>   class SocketReader: Object {
>   Socket socket;
>   Array<Remote*> remotes;
>   public SocketReader(Socket socket) {
>   this.socket = socket;
>   this.remotes = new Array<Remote*>();
>   }
>   public read() {
>   int8[] buffer = new int8[sizeof(Remote)];
>   while(socket.receive(buffer,
>   sizeof(Remote)) > 0) {
>   Remote* remote = Memory.dup(buffer,
>   sizeof(Remote));
>   this.remotes.append_val(remote);
>   }
>   }
>   }
> }
> 
> when read() goes out-of-scope, "buffer" gets freed, So I have to  
>  make a dup of that memory to store it in "remotes" array. But If I
> have some way to tell vala not to free buffer, I dont need to dup the
> buffer.
> 
> Am I doing this right? or any better way? All I need is to get the
> data
> coming from the socket and use it as "Remote" struct. Need your
> suggestions.
> 
> Thanks,
> Mohan R

You should read directly in the memory allocated for the 'Remote'
struct instead of using a temporary buffer. I think it's correct to
cast it to uint8[].

socket.receive ((uint8[]) remote);
remotes.append_val (remote);

However, your code is likely incorrect, because 'Socket.receive' states
that it will read up to 'buffer.length', so you may end with a partial
read.

You need to loop with an offset, something like:

    size_t offset = 0;
    while (offset < sizeof (Remote)
        offset += socket.receive ((uint8[] remote) [offset:sizeof
(Remote) - offset]);

Unless you are doing something very specific, use SocketService, it has
a much simpler interface:

http://valadoc.org/#!api=gio-2.0/GLib.SocketService

The SocketConnection is an IOStream, so you have access to
input_stream.read_all, which will perform a complete read for the
requested buffer size.

> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>
Étudiant au baccalauréat en Informatique à l'Université de MontréalDéveloppeur 
d'application web
Mon blog: https://arteymix.github.io/Mon projet de coopérative: 
https://pittoresque.github.io/Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Need help in async methods

2016-01-16 Thread Guillaume Poirier-Morency
It's not possible block until an async method completes, because that
would block the method progress and defeat the initial purpose.

In particular, synchronous APIs are fully synchronous (unless threads
or inner loop are involved).

You can use the 'yield' keyword to call async methods synchronously:

public async void do_something ();
public async void do_something_2 ();

public async void do_everything () {
    // everything is 'sequential' here
    yield do_something ();
    yield do_something_2 ();
}

public void main (string[] args) {
    do_everything ();
    new MainLoop ().run ();
    return 0;
}

Le samedi 16 janvier 2016 à 15:56 +0100, mar...@saepia.net a écrit :
> Hello,
> 
> I am trying to create a function is synchronous and block for the
> outer
> world, but internally
> 
> a) does nothing unless certain callback is called
> b) does not block mainloop
> 
> Something like synchronous HTTP calls in libsoup - you do request,
> the
> execution if caller is stopped until it's done, the result is just
> returned
> but internally it does asynchronous operations and does not block the
> whole
> program.
> 
> 
> I read tutorial and samples but I still struggle to find the valid
> pattern,
> I came to the point that looks more less like this:
> 
> public class MyClass : Object {
>   private OtherClass other;
>   private SourceFunc other_callback;
>   private bool   other_result;
> 
> 
>   public bool dosomething() {
> // What should I put here to block callee and call
> dosomething_async
> asynchronously?
>   }
> 
> 
>   public async bool dosomething_async() {
> this.other = new OtherClass();
> this.other.finished.connect(on_other_finished);
> 
> this.other_callback = dosomething_async.callback;
> yield;
> // Now everything except the callee should continue execution
> // unless OtherClass sends us a callback
>   }
> }
> 
> 
> private void on_other_finished(bool result) {
>   // Task is finished, should unblock dosomething();
>   this.other_result = result;
>   this.other_callback();
> }
> 
> 
> int main(string[] argv) {
>   var instance = new MyClass();
>   var result = instance.dosomething(); // <-- this should block
> 
>   return 0;
> }
> 
> 
> Thank you for your help
> 
> m.
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Nest ncurses in a Gtk window?

2015-12-04 Thread Guillaume Poirier-Morency
Why don't you use Vte? It's designed to embed terminal http://valadoc.o
rg/#!api=vte-2.91/Vte.Terminal

Sorry if you have received two messages, I did not send the first one
through the mailing list.

Le vendredi 04 décembre 2015 à 19:32 +0100, Gilzad Hamuni a écrit :
> Hi list,
> 
> sorry to ask if this has been answered before, I might have chosen
> the wrong terms while searching.
> 
> Is it possible to nest curses into a Gtk.Window?
> 
> I was thinking of cascading it into a Vte and put that into a
> Gtk.Window but my thoughts kind of got stuck how to approach
> correctly in Vala.
> 
> Background:
> I wrote a Gtk application that emulates a specific terminal using a
> Gtk.TextView to display and format everything. Turns out it's not as
> responsive as it should be and I blame my early choice for the rather
> complex TextView. So I'd probably exchange the TextView by something
> that is more suitable for terminal displays. However, people shall be
> able to see the content in a Gtk.Window. That's where I'm stuck. Any
> advice?
> 
> Thanks a bunch in advance
> 
> gilzad
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Valum]help with process async method.

2015-11-24 Thread Guillaume Poirier-Morency
Le mardi 24 novembre 2015 à 20:59 +0800, Matrix a écrit :
> Hi:
> 
> i'm writing a server side program with valum framework...
> 
> in one entry point,  the server will send a http request to a remote 
> server,

You will need libsoup-2.4 for that, here's an example: https://github.c
om/valum-framework/valum/blob/master/examples/api-interaction/app.vala

> 
> i copy the https://wiki.gnome.org/Projects/Vala/AsyncSamples in my
> code 
> to test
> 
> 
> async double do_calc_in_bg(double val) throws ThreadError {
> SourceFunc callback = do_calc_in_bg.callback;
> double[] output = new double[1];
> 
> // Hold reference to closure to keep it from being freed whilst
> // thread is active.
> ThreadFunc<void*> run = () => {
> // Perform a dummy slow calculation.
> // (Insert real-life time-consuming algorithm here.)
> double result = 0;
> for (int a = 0; a<1000; a++)
> result += val * a;
> 
> // Pass back result and schedule callback
> output[0] = result;
> Idle.add((owned) callback);
> return null;
> };
> Thread.create<void*>(run, false);
> 
> // Wait for background thread to schedule our callback
> yield;
> return output[0];
> }
> 
> void test(Request request, Response response) {
> 
>   do_calc_in_bg.begin(0.001, (obj, res) => {
>   try {
>   double result = do_calc_in_bg.end(res);
>   response.write_all(@"yes, the result is
> $result".data, null);
>   } catch (ThreadError e) {
>   string msg = e.message;
>   stderr.printf(@"Thread error: $msg\n");
>   }
>   });
> }
> 
> 
> but when the thread finished,  call the response.write_all, it fails
> ...
> 
> 2015-11-24 20:37:32: (mod_fastcgi.c.2391) unexpected end-of-file 
> (perhaps the fastcgi process died): pid: 6667 socket: 
> unix:/opt/projects/platformX/install/valum.sock-0
> 2015-11-24 20:37:32: (mod_fastcgi.c.3172) response not received, 
> request sent: 548 on socket: 
> unix:/opt/projects/platformX/install/valum.sock-0 for 
> /verify_code?phone=133, closing connection

FastCGI relies on a blocking function call (namely 'accept') that is
triggered on incoming data. If you decide to delegate some processing
to the GMainLoop, it is likely to be called and block any form of
progress until a new request is received.

I have attempted to solve this issue by the past, but nothing
successful arose.

I think I can do something like:

 - accept in a thread
 - delegate further processing to the GMainLoop

It's important that actual request processing happen in the main
thread, because threading should be a choice left to the developer.

I am also working on wrapping fcgi.vapi in a more GIO-friendly way.

I suggest that you use SCGI for now if you plan to make use of
asynchronous programming, otherwise you can use the synchronous version
of 'send' http://valadoc.org/#!api=libsoup-2.4/Soup.Session.send

> 
> how to implement async method ?
> 
> 3ks a lot!!!

Cheers!

> 
> 
> 
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Cannot throw IOError.from_errno

2015-11-14 Thread Guillaume Poirier-Morency
I cannot throw the result of 'IOError.from_errno' despites it is an
'IOError'.

The following code:

throw IOError.from_errno (errno);

Produces the following error:

error: incompatible types when assigning to type ‘GError * {alias
struct _GError *}’ from type ‘GIOErrorEnum {alias enum }’
   _tmp9_ = g_io_error_from_errno (_tmp8_);

I have to use a dirty hack with GLib.Error and IOError.quark () to make
it work.























-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io
Mon projet de coopérative: https://pittoresque.github.io
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Reading last n lines from file

2015-10-07 Thread Guillaume Poirier-Morency
Le mercredi 07 octobre 2015 à 10:16 -0400, Serge Hooge a écrit :
> Hello, folks.
> 
> I am currently writing a small program with Vala/ncurses and I have
> suddenly found the need to read last n lines of a constantly changing
> file for display in an ncurses window.
> 
> What would be the easiest way to go about it in Vala?
> It doesn't look like GIO is an option without a giant data stream
> kludge, but I kind of need it to create and delete some files along
> the
> way.

You can use a DataInputStream http://valadoc.org/#!api=gio-2.0/GLib.Dat
aInputStream and seek approximately to n * average bytes per line from
the end and read the following data with read_line. It should read
approximately n lines quite efficiently.

You can trigger the operation with a FileMonitor http://valadoc.org/#!a
pi=gio-2.0/GLib.FileMonitor

The other approach involve a subprocess that calls tail.

> 
> Cheers,
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io
Mon projet de coopérative: https://pittoresque.github.io
Clé PGP: B1AD6EA5


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Need some help writing examples for Valum

2015-08-05 Thread Guillaume Poirier-Morency
Hello everyone!

I am about to release a first stable version of Valum (0.2.0) and I
think that providing various examples would be neat.

If you want to learn the tool, why not start with an example? Here's
the issue: https://github.com/valum-framework/valum/issues/115

 * Almanna is an ORM based on libgda
 * bump provides asynchronous primitives
 * libyaml-glib is human-readable JSON
 * redis-glib provides a GLib-layer over hiredis Redis client for key
   -value storage

There's surely other topic to cover using an example, so if you have a
good idea, don't hesitate!

Also, if anyone could notify nemequ that there's pending PRs on his
vala-extra-vapis GitHub repository, I think we would all appreciate
full support for libmemcached and FastCGI binding. I tried (even IRC),
just hope he's fine.

I am currently using the framework to build a web service as part of my
academic project. It's described in this blog post: 
http://arteymix.github.io/valum/2015/08/01/fourteenth-week-update.html 
It's a piece of cake to write ;)

Regards,

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

Mon blog: https://arteymix.github.io
Mon projet de coopérative: https://pittoresque.github.io
Clé PGP: B1AD6EA5

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Need some feedback for Valum, a web micro-framework!

2015-06-30 Thread Guillaume Poirier-Morency
I get an error from waf saying something about a missing feature. You
can test it by building the code from the genie-example branch.

I will try to run an isolated sample just to make sure.

By the way, I am working toward a beta release as I feel that we now
have all the necessary feature to make something usable. Posting on
this mailing list gave me really constructive feedback and I am glad I
did that.

Thanks again!

Le mardi 30 juin 2015 à 18:26 +, Al Thomas a écrit :
  
  From: Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
  Sent: Tuesday, 30 June 2015, 17:22
  Subject: Re: [Vala] Need some feedback for Valum, a web micro
  -framework!
  
  -framework/valum/blob/master/examples/app/main.gs ).
 The Genie example is broken
[indent=2]
namespace ValumGenie.TestApp
  init
var app = new Valum.Router()
app.get(/, handler)
var server = new Valum.FastCGI.Server( app.handle )
server.run( args )
   
   
  def handler (req:VSGI.FastCGI.Request, ref 
   res:VSGI.FastCGI.Response)
var lua = new Valum.Script.Lua()
res.append(lua.eval(print 'hi from lua string'))
   
   
should get a little closer to working (untested)
  
  I will make an example specifically for Genie. The language looks
  pretty nice to describe simple web apps and I think that it's a 
  good
  thing to push it forward. I'll gently pick some of your changes as 
  I am
  not too familiar with the language.
 
 That would be great. Thanks.
 
 In my example:
 - remove the 'namespace' from the beginning, init can't be in a 
 namespace, my mistake
 - the command line arguments are available in 'args', this is 
 automatically available in 'init'
 - 'uses' is the equivalent of 'using' in Vala, so 'uses 
 VSGI.FastCGI' for example
 - I was unsure how the response got passed back, so used 'ref', 
 same as Vala
  
  Also, I think that waf plugin for Vala does not support Genie. 
 
 I don't know Waf, but see:
 https://github.com/waf
 -project/waf/blob/master/waflib/Tools/vala.py#L203  ;
 
 This line lists both .vala and .gs extensions. 
 
 Confirmation Waf works for Genie would be good.
 
 All the best,
 
 Al
 ___
 vala-list mailing list
 vala-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Generating JSON in Vala

2015-06-30 Thread Guillaume Poirier-Morency
It looks like an interesting approach to generate immuable JSON right
from the Vala code.

You should also look into GObject serialization, which is a real
kicker. If you could generate an arbitrary Object with crafted runtime
properties, your tool would be slightly more powerful.

Json.gobject_serialize (new JSONObject (a, JVal.Int, 2));

You could omit the type with GLib.Value and use 
http://www.valadoc.org/#!api=gobject-2.0/GLib.Object.set_property the
generate the properties.

Good luck!

Le mardi 30 juin 2015 à 23:19 +1000, Nick Watts a écrit :
 A couple of days ago, someone named Grindhold sent a message asking 
 about
 generating JSON easily for a web app backend.  I'd been pondering for 
 a
 while how to do this in clean, concise way wrapping varargs around
 json-glib for syntactic sugar.  Tonight I finally sat down and banged 
 out a
 proof of concept, which is available here:
 
 https://github.com/unyieldinggrace/EasyJSON
 
 Hopefully that helps Grindhold!
 ___
 vala-list mailing list
 vala-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Need some feedback for Valum, a web micro-framework!

2015-06-30 Thread Guillaume Poirier-Morency
Le lundi 29 juin 2015 à 22:37 +, Al Thomas a écrit :
 From: Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
  Sent: Saturday, 27 June 2015, 16:35
  Subject: Re: [Vala] Need some feedback for Valum, a web micro
  -framework!
  
  Modules is just a pattern to simplify and decouple an application 
  in
  reusable pieces, so I have never thought about hot plugging them.
 
 There is GModule or probably better, libpeas. The idea of being able
 to create loadable modules, for example for authorization, menus, 
   pagination, etc., seems useful to me. 


The only idea of making loadable applications looks promising,
especially as they could be embedded directly into a VSGI
implementation rather than being compiled alongside. It might just
allow us to implement live reloading.

I do not think that Valum will ever support plugins if we try to keep
it like a micro-framework. 

-framework/valum/blob/master/examples/app/main.gs ).
  The Genie example is broken...
 
 Ah yes, Genie support for anonymous functions is very limited at the 
 moment.
 If you are feeling adventurous download this patch
 https://bug746704.bugzilla
 -attachments.gnome.org/attachment.cgi?id=306096
 for valac and change
 
 var handler = def (req, res)
   res.append(lua.eval(print 'hi from lua string'))
 
 to
 
 handler:VSGI.ApplicationCallback = def (req, res)
   res.append(lua.eval(print 'hi from lua string'))
 
 More practically:
 [indent=2]
 namespace ValumGenie.TestApp
   init
 var app = new Valum.Router()
 app.get(/, handler)
var server = new Valum.FastCGI.Server( app.handle )
 server.run( args )
 
 
   def handler (req:VSGI.FastCGI.Request, ref 
 res:VSGI.FastCGI.Response)
 
 var lua = new Valum.Script.Lua()
 res.append(lua.eval(print 'hi from lua string'))
 
 
 should get a little closer to working (untested)

I will make an example specifically for Genie. The language looks
pretty nice to describe simple web apps and I think that it's a good
thing to push it forward. I'll gently pick some of your changes as I am
not too familiar with the language.

Also, I think that waf plugin for Vala does not support Genie. 
I'll look into this.

There's also Python bindings that can be generated effortlessly with
typelib. It would be great to combine Valum stack with some Python
libraries. I'm just stuck because CTPL does not provide GObject
instrospection data and it is required to generate the full bindings.

 .
 
 As an aside, if anyone is interested in making constructive comments 
 on
 support for anonymous functions in Genie, please take a look at
 https://bugzilla.gnome.org/show_bug.cgi?id=746704
 
 
 
   Finally how flexible is CTPL as the templating engine?CTPL can 
   do certain things like passing variables, looping and
  branching, but it lacks some features like filters, maps and
  inheritence (or just embedding).
  
  It's not even comparable to Twig or Jinja2, but it works and it can 
  do
  some of the job.
  
  I plan to write a Mustache implementation, but for now I think that 
  the
  best thing the framework should focus on is its ability to describe 
  web
  services. The code will be hosted here: 
  https://github.com/valum-framework/mustache-glib
 
 
 OK, seems like Valum is more web services focussed at the moment.
 Mustache seems interesting. Looks as thought some form of inheritance
 may be possible

It's okay to focus on services for now and it is a field where Valum
can perform very well. 

I firmly believe that a decent templating engines is all it takes to
make a framework like Valum usable for web application development and
Mustache can be that one.

 http://stackoverflow.com/questions/7925931/can-mustache-templates-do
 -template-extension
 This is useful for the reasons:
 
 https://github.com/mustache/spec/pull/75
 
 Thanks for the JSON examples,

json-glib is really nicely done and GObject serialization is a real
kicker feature. I tried to cover as much as I could.

I am using that and MySQL bindings to implement the TechEmpower
Framework Benchmarks (
https://github.com/valum-framework/FrameworkBenchmarks). I hope I'll
have a stable release by the next round so that we can see how it
compares!

 
 
 Al
 ___
 vala-list mailing list
 vala-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/vala-list

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Need some feedback for Valum, a web micro-framework!

2015-06-28 Thread Guillaume Poirier-Morency
Here it is:
http://valum-framework.readthedocs.org/en/latest/recipes/json.html

Enjoy!

2015-06-27 11:44 GMT-04:00 Guillaume Poirier-Morency 
guillaumepoiriermore...@gmail.com:

 Le samedi 27 juin 2015 à 12:51 +0200, Daniel Brendle a écrit :
  Hi, Gillaume
 
  I discovered valum in the trending projects list of github a few
  months ago. The first thought was oh wow, i could write my future
  web
  backends in Vala; how cool is that? directly followed by the
  remembrance of how painful it is to parse and generate JSON in vala
  when compared to Go or to Python. To be honest, this is the only
  thing
  that keeps me from giving valum a try. Is there some way of
  conveniently marshalling/unmarshalling JSON in Vala? By convenient i
  mean an programming-effort comparable to pythons json.loads() or Go's
  (un-)marshalling methods? If we had this, valum would seem to be a
  viable option and i'll promise, i'll try it in depth for my next
  web-related project.

 I think that you had your answer from Al. json-glib is a really
 powerful JSON library.

 I will update the documentation with some examples on how to use JSON
 with Valum.

 
 
  Yours, Grindhold
 
 
  ___
  vala-list mailing list
  vala-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/vala-list


 Thank you, I really had great feedback so far!


 --
 Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com




-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Développeur d'application web

*Mon blog:* arteymix.github.io
*Mon projet de coopérative:* pittoresque.github.io
*Clé PGP:* B1AD6EA5
https://pgp.mit.edu/pks/lookup?op=vindexsearch=0x1CCFC3A2B1AD6EA5
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Need some feedback for Valum, a web micro-framework!

2015-06-27 Thread Guillaume Poirier-Morency
Le samedi 27 juin 2015 à 11:51 +, Al Thomas a écrit :
 
 
 
 From: Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
  Sent: Saturday, 27 June 2015, 3:37
  Subject: [Vala] Need some feedback for Valum, a web micro-framework!

 I am working on a web micro-framework this summer as part of an
 academic project. I plan to release a stable and production-ready
 version by the end of this summer and use it to build an application.
 
 The repository is hosted on GitHub: 
 https://github.com/valum-framework/valum
 
 You may also want to review the documentation: 
 http://valum-framework.readthedocs.org/en/latest/
 
 If you are interested into the project and don't mind playing with it 
 a
 little, I would gratefully take some of your feedback because I am
 stabilizing the APIs for good in the incoming releases.
 
 
 The project is interesting.
 I like the idea of using GLib.Resource to server static resources ( h
 ttp://valum-framework.readthedocs.org/en/latest/recipes/static
 -resource.html ). This could potentially be a static content server 
 at the edge of a web application. The idea raised a few questions.
 If a VAPI for libsass ( https://github.com/sass/libsass ), the 
 compiled CSS pre-processor, was to be written would this integrate 
 easily with Valum? It would be a nice workflow for development to 
 change a SASS file and to have the resources re-compiled almost 
 immediately.

That will depend on the complexity of the code, but I am pretty sure
that if it gets binded, I could write a Converter (
http://valadoc.org/#!api=gio-2.0/GLib.Converter) to compress a CSS
stream.

Resources can be bundled separately and loaded dynamically with 
https://developer.gnome.org/gio/unstable/GResource.html#g-resource-load
, so it would be possible to change them at runtime.

 Is there a mechanism for modules to be swapped out at run-time? For 
 example the updated static content module has been tested and passed 
 in development then the module is uploaded to the server and is made 
 immediately available using a mechanism such as inotify on Linux to 
 get Valum to reload? Although I'm not sure of the possible security 
 implications of this.

Modules is just a pattern to simplify and decouple an application in
reusable pieces, so I have never thought about hot plugging them.

 I note one of your examples uses Genie ( https://github.com/valum
 -framework/valum/blob/master/examples/app/main.gs ).This is good for 
 me, but again I wondered how modular the framework is. I got the 
 impression Valum modules ( 
 http://valum-framework.readthedocs.org/en/latest/module.html ) were 
 compiled into a single binary or are they loaded at run-time?

The Genie example is broken...

 
 The framework uses what looks like request and response objects, 
 which I think is pretty common. The docs mention middleware ( http://
 valum-framework.readthedocs.org/en/latest/router.html#middleware ). 
 Have you looked at the design process followed by the PHP Framework 
 Interoperability Group HTTP Message interfaces that they recently 
 released as PSR-7? Some useful links:
 https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7
 -http-message-meta.md
 https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7
 -http-message.mdhttps://mwop.net/blog/2015-05-18-psr-7
 -accepted.htmlhttp://mtdowling.com/blog/2014/07/03/a-case-for-higher
 -level-php-streams/http://srcmvn.com/blog/2015/02/18/psr-7-and-the
 -future-of-php/http://dracony.org/replacing-controllers-with
 -middleware/https://mwop.net/blog/2015-01-08-on-http-middleware-and
 -psr-7.htmlhttps://mwop.net/blog/2015-01-26-psr-7-by-example.html
 There is a useful discussion on the use of streams and it now has a 
 separate interface. Also the response object is immutable.It looks as 
 though middleware is the way Valum intends to handle things like 
 authorization.

I am a bit familiar with PSR-7, but I will surely read it just to see
what lacks in the request-response model.

Middleware will serve many purposes and I like the design I have put on
table. I have already a few prototypes and I will release them in the
next minor release.

 Finally how flexible is CTPL as the templating engine? Jinja2 and 
 Twig are commonly used with Python and PHP respectively. It looks as 
 though node.js has plenty of npm modules implementing aspects of 
 these. Does/will CTPL be able to provide such functionality in future 
 or does Valum allow another templating engine to be swapped in? 
 Templates typically follow the composite pattern ( 
 https://tiles.apache.org/framework/tutorial/pattern.html ). Although 
 the Scala Play framework takes an interesting approach ( 
 https://www.playframework.com/documentation/2.2.x/ScalaTemplates ) 
 that seems similar to CTPL at first glance. Is CTPL similar to Play 
 templates? It would be nice to have an example of site/section/page 
 in the docs for Valum. So a single template is used for the site, 
 this includes a sub-template

Re: [Vala] Need some feedback for Valum, a web micro-framework!

2015-06-27 Thread Guillaume Poirier-Morency
Le samedi 27 juin 2015 à 12:51 +0200, Daniel Brendle a écrit :
 Hi, Gillaume
 
 I discovered valum in the trending projects list of github a few
 months ago. The first thought was oh wow, i could write my future 
 web
 backends in Vala; how cool is that? directly followed by the
 remembrance of how painful it is to parse and generate JSON in vala
 when compared to Go or to Python. To be honest, this is the only 
 thing
 that keeps me from giving valum a try. Is there some way of
 conveniently marshalling/unmarshalling JSON in Vala? By convenient i
 mean an programming-effort comparable to pythons json.loads() or Go's
 (un-)marshalling methods? If we had this, valum would seem to be a
 viable option and i'll promise, i'll try it in depth for my next
 web-related project.

I think that you had your answer from Al. json-glib is a really
powerful JSON library.

I will update the documentation with some examples on how to use JSON
with Valum.

 
 
 Yours, Grindhold
 
 
 ___
 vala-list mailing list
 vala-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/vala-list


Thank you, I really had great feedback so far!


-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Need some feedback for Valum, a web micro-framework!

2015-06-26 Thread Guillaume Poirier-Morency
Hi everyone!

I am working on a web micro-framework this summer as part of an
academic project. I plan to release a stable and production-ready
version by the end of this summer and use it to build an application.

The repository is hosted on GitHub: 
https://github.com/valum-framework/valum

You may also want to review the documentation: 
http://valum-framework.readthedocs.org/en/latest/

It's really similar to Express.js and Sinatra if you are familiar with
web frameworks and designed to support multiple web technologies.

And if you wonder how fast it is, it performs slightly faster than
Node.js according to a superficial Hello world! benchmark. (I will
make some better benchmark with different load size on my final report)

If you are interested into the project and don't mind playing with it a
little, I would gratefully take some of your feedback because I am
stabilizing the APIs for good in the incoming releases.

I might also need help with Debian packaging, because I literally have
no clue about how it works.

Thanks for the consideration,

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Research project on the Vala compiler

2015-04-05 Thread Guillaume Poirier-Morency
I will look further into git.gnome.org, it looks really promising.

Also, I thought of just running per-language search on GitHub, 
Bitbucket and other hosting services.

I am currently compiling meta-data of the projects in a YAML file so 
that the checkout, configure, build and computation processes can be 
easily automated and reproduced.

Thank you for the suggestions! I am always open to more ideas.

Le dimanche 05 avril 2015 à 06:17 -0500, Daniel Espinosa a écrit :
 You could add two projects in your list:
 GXml:  git.gnome.org/browse/gxml
 LibreSCL: github.com/pwmediaconsulting/librescl
 Both are written in Vala and generate C code to compile binaries.
 I'm the maintener  of both then I can help you and of course I'm one 
 of the most interested.
 Both are LGPL and I've found lot of memory leaks and I start to 
 investigate generated C source code.
 El abr 3, 2015 1:10 PM, Guillaume Poirier-Morency 
 guillaumepoiriermore...@gmail.com escribió:
  Hi everyone!
  
  I am conducting a small research project on the Vala compiler that
  would principally study how it affects different quality metrics
  (size, complexity, etc...) during the implementation step of the
  development.
  
  My goal is to confirm the relevance of metrics measured in the
  generated C code to evaluate the quality of the sources. This is
  important considering the impressive amount of tools that have been
  developed to measure the quality of C/C++ sources.
  
  By the same time, I also want to provide an empirical model that 
  would
  allow transformations of the measured metrics into significative
  measures for the sources. For example we could be interested into
  knowing the relationship between the size of input and output of 
  valac
  or the impact on the cyclomatic complexity.
  
  Therefore, I am interested in projects of all size written in Vala
  that generates C code during the build process. It would also be 
  great
  to have indications on how the sources are structured and how I can
  extract them.
  
  Ex. cloc $(find src -name '*.vala') $(find build -name '*.c')
  
  Yet, I have these projects in mind:
  
* vala 30 KLOC
* valadoc 23.5 KLOC
* gnome-pomodoro 4.6 KLOC
  
  I plan to use it as an empirical justification to setup a set of
  measurements to control the quality of Valum, a web micro-
  framework I
  will work on this summer.
  
  The results will be all released under a Creative Commons license.
  
  Thanks in advance :)
  
  --
  Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
  ___
  vala-list mailing list
  vala-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/vala-list
  
-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Research project on the Vala compiler

2015-04-03 Thread Guillaume Poirier-Morency
Hi everyone!

I am conducting a small research project on the Vala compiler that 
would principally study how it affects different quality metrics 
(size, complexity, etc...) during the implementation step of the 
development.

My goal is to confirm the relevance of metrics measured in the 
generated C code to evaluate the quality of the sources. This is 
important considering the impressive amount of tools that have been 
developed to measure the quality of C/C++ sources.

By the same time, I also want to provide an empirical model that would 
allow transformations of the measured metrics into significative 
measures for the sources. For example we could be interested into 
knowing the relationship between the size of input and output of valac 
or the impact on the cyclomatic complexity.

Therefore, I am interested in projects of all size written in Vala 
that generates C code during the build process. It would also be great 
to have indications on how the sources are structured and how I can 
extract them.

Ex. cloc $(find src -name '*.vala') $(find build -name '*.c')

Yet, I have these projects in mind:

  * vala 30 KLOC
  * valadoc 23.5 KLOC
  * gnome-pomodoro 4.6 KLOC

I plan to use it as an empirical justification to setup a set of 
measurements to control the quality of Valum, a web micro-framework I 
will work on this summer.

The results will be all released under a Creative Commons license.

Thanks in advance :)

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com

signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] How does IOError.from_errno works?

2015-03-03 Thread Guillaume Poirier-Morency
I would like to convert errors coming from some bindings to appropriate
IOError using errno codes.

http://valadoc.org/#!api=gio-2.0/GLib.IOError.from_errno

I have tried the following:

throw IOError.from_errno (this.err.get_error ());

But I get the following complication error:

src/vsgi/fastcgi.c:1170:10: erreur: incompatible types when
assigning to type ‘struct GError *’ from type ‘GIOErrorEnum’
   _tmp7_ = g_io_error_from_errno (_tmp6_);

Is it a bug?

Thanks in advance!

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] How do I access command line arguments from a main block?

2015-02-20 Thread Guillaume Poirier-Morency
Simple question here!

How can I access the CLI arguments from a main block? Is there something
like a predefined variable?

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How do I access command line arguments from a main block?

2015-02-20 Thread Guillaume Poirier-Morency
You missed the vala-list in CC in your answer, so I will just repeat
myself.

By 'main block', I meant the experimental main block feature. I am well
aware of how arguments are accessed usually, but I would like to know
how it is done it this particular case.

Take this as an example of main block:


https://github.com/valum-framework/valum/blob/master/examples/app/app.vala
  
Le vendredi 20 février 2015 à 22:51 -0600, David Lechner a écrit :
 On 02/20/2015 09:41 PM, Guillaume Poirier-Morency wrote:
  Simple question here!
 
  How can I access the CLI arguments from a main block? Is there something
  like a predefined variable?
 
 
 Sure, just have a string[] argument.
 
 public static int main (string[] args) {
  return 0;
 }
 

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Bad C code generation (lvalue required as unary '' operand)

2015-01-29 Thread Guillaume Poirier-Morency
Le jeudi 29 janvier 2015 à 16:58 +0100, yannick inizan a écrit :
 the old safe method : 
 
 
 public static void main (string[] args) {
 Value? v = toto;
 Value val = {};
 val.init (v.type());
 v.copy (ref val);
 print (%s\n, (string)val);
 }
 
 
 p.s. : sorry for last message (*$£% gmail)
 
 2015-01-29 16:48 GMT+01:00 Guillaume Poirier-Morency
 guillaumepoiriermore...@gmail.com:
 Le jeudi 29 janvier 2015 à 15:30 +0100, yannick inizan a
 écrit :
  Vala translate your cast to a get_type function of your
 value.
 
  ex:
  Value v = toto;
  var val = (string)v; //equals to 'var val = v.get_string();'
 
  so (Value)my_val is impossible because GLib.Value doesn't
 have a
  get_value function.
 
  2015-01-29 15:16 GMT+01:00 Guillaume Poirier-Morency
  guillaumepoiriermore...@gmail.com:
  I am working on Valum, a web micro-framework written
 in Vala
  https://github.com/antono/valum
 
  valac is generating very strange code that doesn't
 compile.
 
  Part of the framework is about offering facilities
 to push
  arbitrary
  values into CTPL template environment.
 
  At some point, I try to case a Value? to a non-null
 Value (I
  have of
  course tested the null case, I just want it to pass
 under
  --enable-experimental-non-null)
 
  vala --version
 
  Vala 0.26.1
 
  Here's the use case:
 
  Value? v;
  var val = (Value) v;
 
  The error:
 
 
  lvalue required as unary ‘’ operand
 
  I attached the full log and the bug is easily
 reproducible
  (the sample
  does it).
 
  --
  Guillaume Poirier-Morency
 guillaumepoiriermore...@gmail.com
 
  ___
  vala-list mailing list
  vala-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/vala-list
 
 
 
 
 
 Thanks for the answer!
 
 That kind of code should be detected by Vala compiler as an
 error.
 
 What approach would you recommend to cast Value? to
 Value ?
 
 It's not that bad if it is not yet possible, but I would
 really like to
 build the whole projet with --enable-experimental-non-null ;)
 
 
 --
 Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
 
 

Great! That should do the trick for now :)
-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Bad C code generation (lvalue required as unary '' operand)

2015-01-29 Thread Guillaume Poirier-Morency
Le jeudi 29 janvier 2015 à 17:46 +0100, yannick inizan a écrit :
 add an 'v != null' assertion to avoid GLib Critical error :)
 
 2015-01-29 17:42 GMT+01:00 Guillaume Poirier-Morency
 guillaumepoiriermore...@gmail.com:
 Le jeudi 29 janvier 2015 à 16:58 +0100, yannick inizan a
 écrit :
  the old safe method :
 
 
  public static void main (string[] args) {
  Value? v = toto;
  Value val = {};
  val.init (v.type());
  v.copy (ref val);
  print (%s\n, (string)val);
  }
 
 
  p.s. : sorry for last message (*$£% gmail)
 
  2015-01-29 16:48 GMT+01:00 Guillaume Poirier-Morency
  guillaumepoiriermore...@gmail.com:
  Le jeudi 29 janvier 2015 à 15:30 +0100, yannick
 inizan a
  écrit :
   Vala translate your cast to a get_type function
 of your
  value.
  
   ex:
   Value v = toto;
   var val = (string)v; //equals to 'var val =
 v.get_string();'
  
   so (Value)my_val is impossible because GLib.Value
 doesn't
  have a
   get_value function.
  
   2015-01-29 15:16 GMT+01:00 Guillaume
 Poirier-Morency
   guillaumepoiriermore...@gmail.com:
   I am working on Valum, a web
 micro-framework written
  in Vala
   https://github.com/antono/valum
  
   valac is generating very strange code that
 doesn't
  compile.
  
   Part of the framework is about offering
 facilities
  to push
   arbitrary
   values into CTPL template environment.
  
   At some point, I try to case a Value? to a
 non-null
  Value (I
   have of
   course tested the null case, I just want
 it to pass
  under
   --enable-experimental-non-null)
  
   vala --version
  
   Vala 0.26.1
  
   Here's the use case:
  
   Value? v;
   var val = (Value) v;
  
   The error:
  
  
   lvalue required as unary ‘’
 operand
  
   I attached the full log and the bug is
 easily
  reproducible
   (the sample
   does it).
  
   --
   Guillaume Poirier-Morency
  guillaumepoiriermore...@gmail.com
  
  
  ___
   vala-list mailing list
   vala-list@gnome.org
  
  https://mail.gnome.org/mailman/listinfo/vala-list
  
  
  
 
 
  Thanks for the answer!
 
  That kind of code should be detected by Vala
 compiler as an
  error.
 
  What approach would you recommend to cast Value?
 to
  Value ?
 
  It's not that bad if it is not yet possible, but I
 would
  really like to
  build the whole projet with
 --enable-experimental-non-null ;)
 
 
  --
  Guillaume Poirier-Morency
 guillaumepoiriermore...@gmail.com
 
 
 
 
 Great! That should do the trick for now :)
 --
 Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
 
 

Another of my concern on the matter..

assert_null (null);

Doesn't work very nicely. Is it because Vala has a defined null? like
Python has for None? and that function checks for a NULL pointer?
-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Bad C code generation (lvalue required as unary ‘’ operand)

2015-01-29 Thread Guillaume Poirier-Morency
I am working on Valum, a web micro-framework written in Vala
https://github.com/antono/valum

valac is generating very strange code that doesn't compile.

Part of the framework is about offering facilities to push arbitrary
values into CTPL template environment.

At some point, I try to case a Value? to a non-null Value (I have of
course tested the null case, I just want it to pass under
--enable-experimental-non-null)

vala --version

Vala 0.26.1

Here's the use case:

Value? v;
var val = (Value) v;

The error:


lvalue required as unary ‘’ operand 

I attached the full log and the bug is easily reproducible (the sample
does it).

-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
test.vala:3.1-1.9: warning: main blocks are experimental
test.vala:3.5-3.19: warning: local variable `val' declared but never used
var val = (Value) v;
^^^
In file included from /usr/include/glib-2.0/gobject/gobject.h:24:0,
 from /usr/include/glib-2.0/gobject/gbinding.h:29,
 from /usr/include/glib-2.0/glib-object.h:23,
 from /home/guillaume/test.vala.c:6:
/home/guillaume/test.vala.c: In function ‘_vala_main’:
/home/guillaume/test.vala.c:21:18: erreur: lvalue required as unary ‘’ operand
  if (G_IS_VALUE (((GValue) (*_tmp0_ {
  ^
/usr/include/glib-2.0/gobject/gtype.h:1941:58: note: in definition of macro 
‘_G_TYPE_CHV’
 #define _G_TYPE_CHV(vl)   (g_type_check_value ((GValue*) vl))
  ^
/usr/include/glib-2.0/gobject/gvalue.h:50:29: note: in expansion of macro 
‘G_TYPE_CHECK_VALUE’
 #define G_IS_VALUE(value)  (G_TYPE_CHECK_VALUE (value))
 ^
/home/guillaume/test.vala.c:21:6: note: in expansion of macro ‘G_IS_VALUE’
  if (G_IS_VALUE (((GValue) (*_tmp0_ {
  ^
In file included from /usr/include/glib-2.0/gobject/gobject.h:25:0,
 from /usr/include/glib-2.0/gobject/gbinding.h:29,
 from /usr/include/glib-2.0/glib-object.h:23,
 from /home/guillaume/test.vala.c:6:
/home/guillaume/test.vala.c:22:40: erreur: lvalue required as unary ‘’ operand
   g_value_init (_tmp1_, G_VALUE_TYPE (((GValue) (*_tmp0_;
^
/usr/include/glib-2.0/gobject/gvalue.h:59:43: note: in definition of macro 
‘G_VALUE_TYPE’
 #define G_VALUE_TYPE(value)  (((GValue*) (value))-g_type)
   ^
/home/guillaume/test.vala.c:23:17: erreur: lvalue required as unary ‘’ operand
   g_value_copy (((GValue) (*_tmp0_)), _tmp1_);
 ^
error: cc exited with status 256
Compilation failed: 1 error(s), 2 warning(s)


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Bad C code generation (lvalue required as unary '' operand)

2015-01-29 Thread Guillaume Poirier-Morency
Le jeudi 29 janvier 2015 à 15:30 +0100, yannick inizan a écrit :
 Vala translate your cast to a get_type function of your value.
 
 ex: 
 Value v = toto;
 var val = (string)v; //equals to 'var val = v.get_string();'
 
 so (Value)my_val is impossible because GLib.Value doesn't have a
 get_value function.
 
 2015-01-29 15:16 GMT+01:00 Guillaume Poirier-Morency
 guillaumepoiriermore...@gmail.com:
 I am working on Valum, a web micro-framework written in Vala
 https://github.com/antono/valum
 
 valac is generating very strange code that doesn't compile.
 
 Part of the framework is about offering facilities to push
 arbitrary
 values into CTPL template environment.
 
 At some point, I try to case a Value? to a non-null Value (I
 have of
 course tested the null case, I just want it to pass under
 --enable-experimental-non-null)
 
 vala --version
 
 Vala 0.26.1
 
 Here's the use case:
 
 Value? v;
 var val = (Value) v;
 
 The error:
 
 
 lvalue required as unary ‘’ operand
 
 I attached the full log and the bug is easily reproducible
 (the sample
 does it).
 
 --
 Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com
 
 ___
 vala-list mailing list
 vala-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/vala-list
 
 
 

Thanks for the answer! 

That kind of code should be detected by Vala compiler as an error.

What approach would you recommend to cast Value? to Value ? 

It's not that bad if it is not yet possible, but I would really like to
build the whole projet with --enable-experimental-non-null ;)


-- 
Guillaume Poirier-Morency guillaumepoiriermore...@gmail.com


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list